Skip to content

serializeQuery

serializeQuery(query): string

Defined in: serialize-query.ts:15

Serialize a nested query object into the bracket-notation query string that every Mantle HTTP transport parses back into the identical object via parseQueryString in @mantlejs/mantle (Express’s qs produces the same shape):

{ age: { $gt: 21 } } → “age[$gt]=21” { $or: [{ role: “admin” }] } → “$or[0][role]=admin” { tags: [“a”, “b”] } → “tags[0]=a&tags[1]=b”

Values arrive server-side as strings — type coercion is the server schema’s concern. undefined values are dropped; null serializes as an empty string (matching qs), so IS NULL queries need server-side coercion.

Record<string, unknown>

string