What happens when you paste

The tool parses your text as soon as it changes. If the JSON is valid, the result is written into the output panel with the indentation you chose. If it is not, the output panel keeps whatever was there before and the error box explains what went wrong.

The error is reported with a line and a column, plus the character offset, so you can jump straight to the spot rather than scanning the whole payload. The position is worked out by scanning the document itself, which means it does not depend on how your browser happens to word its own parse errors.

The formatting controls

  • 2 spaces is the default and keeps deeply nested payloads narrow. 4 spaces makes the nesting levels easier to count by eye. Tab is the safe choice when several people with different editor settings work on the same file.
  • Sort object keys alphabetically reorders the keys of every object. The values and the nesting stay exactly as they were — only the order of the keys changes.
  • Escape < and > for safe HTML embedding turns the characters that a browser would otherwise read as markup into their HTML entities, which is what you need when a payload is dropped into a page. The HTML, CSS & JavaScript Minifier strips the markup around it as well.
  • Format pretty-prints with the chosen indentation. Minify strips the whitespace and puts the document on a single line.

How to use it

  1. Paste the payload into the input panel, or hit Load sample to see the controls at work.
  2. Pick an indentation and, if it matters to you, tick Sort object keys alphabetically.
  3. Press Format to read it, or Minify to send it.
  4. If the error box appears, read the line and column, fix that spot in your original payload and paste it back.
  5. Copy the result, or download it as a data.json file.
  6. If the payload arrived Base64-encoded, the Base64 tool turns it back into readable text first.

Good to know

  • Real JSON is strict. Comments, single quotes and trailing commas are rejected — they are common in hand-written config files and in some HTTP clients, but they are not JSON, and the validator will tell you so rather than guessing what you meant.
  • Sorting keys is a review aid, not a transformation of the data. Two payloads that describe the same thing produce the same sorted output, so a diff between them shows only the lines that really changed.
  • The tool re-serialises the parsed value, so formatting also normalises the payload: number formats and unicode escapes are rewritten in the standard form. If you need the exact bytes that came in, keep the original.
  • Because a value can only appear once per object, a payload with the same key written twice ends up with the last value. If that matters to you, check the source before you trust the output.
  • Nothing is uploaded. The parse happens in the page, so a payload with customer data in it never travels.