API/stringify
stringify
src/utils/stringify.tsfunction
stringify()
Section titled “stringify()”stringify(payload: Record<string, QueryValue>): stringSerialise a nested object into bracket-notation query-string segments.
Replaces the single qs.stringify(payload, { encode: false }) call shape the
request strategies used — the only qs feature this library ever needed.
Behaviour, matched against qs@6 and pinned by stringify.spec.ts:
{ a: 1, b: 'x' } -> a=1&b=x{ filters: { status: { $eq: 'p' } } } -> filters[status][$eq]=p{ populate: ['a', 'b'] } -> populate[0]=a&populate[1]=b{ a: undefined } -> '' (key skipped entirely){ a: null } -> a= (key kept, value empty){ a: [] } / { a: {} } -> '' (nothing to emit)Values are not percent-encoded. Backends receiving these query strings
expect literal brackets and operators (filters[status][$eq]), and
URLSearchParams offers no way to opt out of encoding — which is why it
cannot serve as a substitute here.
| Parameter | Type | Description |
|---|---|---|
payload |
Record<string, QueryValue> |
The object to serialise |
Returns — Query-string segments joined with &, or an empty string
