IT Market
Tools/Code/Documents/JSON to Query String Converter Online
JSON → QUERY

Конвертируйте JSON в URL параметры

Tool guide

JSON to Query String Converter Online

Paste an object of key-value pairs and get back a string such as page=2&sort=price, ready to append to an endpoint after the question mark. Parsing and assembly happen in a small script on the page itself, so the text in JSON Input never leaves the tab. Handy when you are reproducing an API call from the docs by hand, tagging a campaign link with UTM parameters, or moving filters out of a POST body into a GET address you can paste into a ticket. See also: parse a URL query string back into JSON, check the JSON for errors before building the link, percent-encode a single value.

How to use it

  1. Paste your data into the JSON Input box. The top level has to be an object in curly braces; a bare array has nothing to name its parameters.
  2. Check the quoting. Only double quotes parse; single quotes and a trailing comma after the last pair will stop the conversion.
  3. Press Convert. The assembled string appears in the Query String box below, without a leading question mark.
  4. Hit Copy and append the string to your endpoint after the ? — the pairs are already joined with ampersands.
  5. To change one parameter, edit it in the JSON and press Convert again; the output box is rewritten from scratch each time.

FAQ

What happens to spaces and non-Latin characters in values?

Every value goes through encodeURIComponent, so a space becomes %20, non-Latin letters become percent triplets, and any & or = inside a value is escaped instead of breaking the string apart. That is correct behaviour: the server decodes it back to your original text. If you want a human-readable link for an email, paste it into the browser address bar and it will display the characters again.

Can I pass a nested object or an array?

Flat objects map one to one. Nested structures have no single standard in a query string: some backends expect filter[color]=red, others filter.color=red, others a serialised JSON blob in a single parameter. The tool does not guess your API's convention, so flatten nested data into plain keys yourself and check the expected shape in the service documentation first.

Does the output include the leading question mark?

No, the Query String box gives you the parameters only. The ? belongs once, between the path and the parameters: /api/v1/orders?page=3&per_page=50. If the address already carries parameters, join yours with & rather than a second question mark, otherwise everything after it is read as part of the previous value.

Is my JSON uploaded anywhere while it is converted?

The parsing and the string building are done by a script inside the page, which makes no network call carrying your text. A tab that is already open keeps working with the connection cut. Remember, though, that query strings end up in server logs, browser history and the Referer header by design, so never put tokens or passwords into parameters, whatever built them.

Why is the output box empty after I press Convert?

Almost always the input is not valid JSON: a missing closing brace, an unquoted key, a trailing comma after the last pair, or a snippet copied from JavaScript source with single quotes. Run the text through the JSON Formatter and Validator, fix the reported position and come back. An empty object also yields an empty string, which is expected rather than a failure.

How do I turn a finished link back into an object?

Use the companion Query string to JSON page: it splits the tail of an address into an object and decodes the percent escapes. A full round trip is not byte-identical, because a URL stores everything as text — the number 30 comes back as the string "30" and true as "true". Cast the types yourself after parsing.

Examples

Paging and sorting on an API call
Before: {"page": 3, "per_page": 50, "sort": "-created_at"}
After: page=3&per_page=50&sort=-created_at
Campaign link for a newsletter
Before: {"utm_source": "email", "utm_medium": "newsletter", "utm_campaign": "autumn sale"}
After: utm_source=email&utm_medium=newsletter&utm_campaign=autumn%20sale