Defjs
Core

withQuerySerializer

Replaces query encoding for HTTP, SSE, and WebSocket requests.

@defjs/core · Function

Signature

function withQuerySerializer(serializer: QuerySerializer): ClientOption;

serializer(query) receives the encoded wire object: aliases applied, Date as an ISO string, bigint as a string. Nested objects and arrays are kept as they are. It must return the query string without a leading ?. The string is used verbatim.

It is not called when the request has no query. A builder that returns URLSearchParams skips it. Without this option, queries use URLSearchParams: arrays repeat keys and a nested object fails.

Parameters

Prop

Type

serializer QuerySerializer

Function that turns an encoded query object into a string.

Returns

An option that sets config.querySerializer.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao