Build query strings from flat JSON objects. Array values emit repeated keys; null and undefined properties are skipped. Output omits the leading question mark so you can append it when assembling full URLs for HTTP clients, tests, and agent fetch wrappers.
How it works
The root JSON object is walked key by key. Scalar values are encoded with standard URL parameter encoding (encodeURIComponent). Array values produce multiple key=value pairs with the same key name. null and undefined entries are omitted entirely. Pairs are joined with & in stable key-insertion order from the parsed object.
When to use it
- Construct GET request URLs in agent HTTP clients and integration tests
- Serialize form fields for mocks without hand-escaping spaces or symbols
- Round-trip with the parse-query-string tool to verify encoding behavior
- Build signed webhook callback URLs from structured config objects
Example
{"q":"hello world","page":2} serializes to q=hello+world&page=2 (spaces may appear as + or %20 depending on the encoder). Arrays like {"tag":["a","b"]} become tag=a&tag=b.
Limitations
The root JSON value must be an object—not an array or bare string. Nested objects are not flattened automatically; stringify nested structures before encoding if you need a single value per key. Processing runs in the browser; very large objects may be slow to serialize.