Query String to JSON

Convert a URL query string into JSON and back, with repeated keys becoming arrays and every value decoded properly.

Conversion runs entirely in your browser. A URL taken from a log or an authenticated session stays on your machine.

What It Does

Paste a query string — or a whole URL, since everything before the question mark is ignored — and get JSON. The part that matters is what happens to a key appearing twice. Something like tag=a&tag=b is the standard way to express a list, and a converter that keeps only the last value silently throws half the data away. Here it becomes an array, which is what every server-side framework does and what the sender meant. Values are percent-decoded and the plus-sign rule is applied correctly, so a genuine plus must have arrived as %2B. It converts back as well, encoding each value so that an ampersand or hash inside one cannot terminate the parameter early.

When to Use It

  • A tracking or redirect URL has a dozen parameters and you need to see them as readable structured data.
  • You are debugging why a form submission is not arriving as expected and want to see exactly what the query carried.
  • An API expects a query string and you have the parameters as JSON.
  • A URL pulled from a log needs its parameters extracted for analysis.
  • You want to confirm a value containing an ampersand was encoded properly before sending the link.

Worked Examples

?name=Jane+Doe&role=admin&active=true

The straightforward case. The plus becomes a space because that is the query-string rule, and the values arrive decoded — note that active is the string true rather than a boolean, since a query string carries no types.

?tag=news&tag=sport&tag=tech

The repeated key case, and the reason this tool exists. Three values under one name become an array. A parser keeping only the last would report tech and silently lose the other two.

https://example.com/search?q=C%2B%2B&page=2#results

A full URL. Everything before the question mark is ignored and the fragment after the hash is dropped, because it never reaches the server. The %2B decodes to a real plus, so the search term is C++ rather than a C followed by spaces.

Features

Query string or full URL accepted
Repeated keys collected into arrays
Optional force-array mode for consistent consumers
Bracket-style nesting expanded on request
Correct plus-sign and percent-decoding
Fragment and path stripped automatically
Reverse conversion from JSON to an encoded query string
Keys with no value reported as a server sees them
Parameter count and duplicate detection
Runs entirely in your browser

How to Use

1. Choose a direction — query string to JSON, or JSON to query string. 2. Paste a query string, a whole URL, or your JSON. 3. The result appears immediately, with a note about repeated keys and anything unusual. 4. Turn on bracket nesting only if the sender used the PHP or Rails convention. 5. Copy the result.

Common Mistakes

  • Keeping only the last value for a repeated key. That is the standard way to send a list, so discarding the rest loses real data with no warning at all.
  • Treating a plus as a literal plus. In a query string it decodes to a space, so a genuine plus has to be sent as %2B or it arrives as whitespace.
  • Assuming bracket nesting is standard. It is a PHP and Rails convention rather than part of any URL specification, and reading it when the sender did not intend it invents structure.
  • Forgetting to encode values when building a query string. An unencoded ampersand or hash inside a value ends the parameter, which is how tracking links quietly lose half their data.
  • Expecting the fragment to reach your server. Everything after a hash stays in the browser, so it never appears in your backend or your logs.

Frequently Asked Questions

Explore related topics

#URL #JSON #Converter