Query String Parser

Every parameter, repeats included.

As

Every parameter, repeats included.

How to use it

  1. Paste the URL. The whole address, or just the query part if that is what you have.
  2. Read the parameters. Decoded, one per row, in the order they appear.
  3. Switch to JSON if you need it. A repeated key becomes an array rather than being dropped.

When you would use this

Reading a query string by eye is fine until it has fifteen parameters, three of them percent encoded and two of them repeated. The repeats are the reason to have a tool rather than a one line snippet. The obvious approach turns the string into an object, and an object cannot hold two values for one key, so all but the last are silently dropped. Repeated keys are exactly how arrays are passed, so the parameter you were investigating is the one that disappears. Everything is kept here, in order, with the repeated keys named. A plus is decoded as a space, because that is the form encoding rule and browsers submit forms that way. A literal plus arrives percent encoded, so nothing is lost. A malformed escape is shown as it was written rather than stopping the parse. One stray percent sign should not hide the rest of the URL from you. The whole address is accepted, since that is what is on the clipboard, and the fragment is dropped because it is not part of the query.

Questions

What happens to a repeated key?
It is kept. Repeated keys are how arrays are passed in a query string, and turning the string into an object silently drops all but the last value. The table shows each one and names the repeated keys underneath. In JSON they become an array, which is the only shape that does not lose data.
Why is a plus decoded as a space?
Because that is the form encoding rule, and browsers submit forms that way, so a query string in the wild is far more likely to have used it than not. A literal plus in a value arrives percent encoded.
What happens with a broken escape?
The value is shown as written and everything else still parses. A single stray percent sign should not stop you seeing the other twelve parameters, which is what throwing would do.