Query Params ⇄ JSON

Convert between a URL query string and a JSON object

How to use

When converting Query → JSON, repeated keys with the same name are merged into an array automatically; for JSON → Query, nested objects use a[b] brackets for the path and arrays expand into multiple a[0]=… entries.

FAQ

What happens to duplicate keys?

For example a=1&a=2 becomes {"a":["1","2"]} in JSON, and expands back into multiple same-name params, so the round trip works.

Will special characters be encoded?

JSON → Query calls encodeURIComponent to encode Chinese and symbols; the reverse uses decodeURIComponent to restore them.