Format Code Now
/

JSON URL Decode

ED-34

Paste URL-encoded JSON and get formatted JSON back. You can also decode only, decode twice for double-encoded data, or encode JSON for use in a URL.

Runs in your browser. Nothing is uploaded.

URL-encoded JSON, or JSON for the encode action

Result

How to use it

  1. Paste the percent-encoded JSON, for example %7B%22id%22%3A1%7D.
  2. Tick Decode twice if the text was encoded two times, and choose the indent.
  3. Click Decode and format.
  4. To go back, paste JSON and click Encode JSON.

What decoding does

Percent-encoding writes bytes as %XX, so %7B is { and %22 is a double quote. The tool decodes the bytes as UTF-8, checks that the result parses as JSON and prints it with the indent you choose. Large integers keep all their digits. Decode only returns the decoded text without the JSON check, which is useful if the text turns out not to be JSON. A plus sign stays a plus unless you tick the option, since only form data uses it for a space.

Encoding JSON for a URL

Encode JSON removes the whitespace between tokens, then percent-encodes everything except letters, digits and - _ . ! ~ * ' ( ), the same set that JavaScript encodeURIComponent leaves alone. That is the form to use as one query parameter value. The tool works on the text you paste: it does not pick a parameter out of a full URL, so remove the part before the value first.

Error messages and what to do

MessageWhat it meansFix
Not valid percent-encodingA % is not followed by two hex digits, or the decoded bytes are not UTF-8.Encode a literal % as %25, or check where the text was cut.
The decoded text is not valid JSONDecoding worked, but the result does not parse as JSON.Use Decode only to look at the text, or try Decode twice.

Questions people ask

How do I decode URL-encoded JSON?

Paste the encoded text and click Decode and format. Each %XX sequence becomes its character, and the result is parsed and indented as JSON. If it was encoded twice, tick Decode twice first.

Why do I still see percent signs after decoding?

The data was probably encoded twice, so the first decode leaves a second layer such as %22 inside the text. Tick Decode twice, or run Decode only and then decode the result again.

What does %7B%22 mean in JSON?

%7B is the opening brace { and %22 is a double quote, so %7B%22 starts a JSON object whose first key is in quotes. The pattern shows up at the start of most URL-encoded JSON objects.

Does a plus sign become a space?

Only if you tick the option. In a query string from an HTML form a plus means a space, but in a path or in data encoded with encodeURIComponent it is a literal plus, so the default keeps it.

Can I encode JSON for a URL here?

Yes, click Encode JSON. The JSON is minified and percent-encoded, ready to be used as a query parameter value. Invalid JSON gives an error before anything is encoded.

About this tool

Decoding reverses percent-encoding (%7B becomes {) as UTF-8 and then checks that the result is JSON and prints it with the indentation you choose. Decode only skips the JSON check, so it works for any percent-encoded text. Numbers are kept as written. A + is left alone unless you tick the option, because only form data uses it for a space. Encode JSON removes whitespace outside strings first and then encodes everything except letters, digits and - _ . ! ~ * ' ( ). It does not read whole URLs or pick a query parameter out of one.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.