The query object to encode
The output format:
"json" — Percent-encoded JSON; human-readable but verbose;
see JSON Serialization"base64" — Base64-encoded JSON; compact and URL-safe"form" — Form-encoded key=value pairs;
most compatible with standard tooling; see Form SerializationThe encoded query string
The "form" format always encodes to canonical form:
>=price=100)name="widget")null remain unquoted (JSON literals)^price=1, ^name=-2)This ensures consistent, predictable output. The decoder accepts both canonical and shorthand forms (e.g., postfix
operators like price>=100, unquoted strings like name=widget).
Encodes a query as a URL-safe string.
Serializes a Query object into a string representation suitable for transmission as a URL query string in GET requests. The output format can be selected based on readability, compactness, and compatibility requirements.