Skip to content
PocketDesk
Your files are processed on your device, never uploaded

JSON formatter

  • On device
Input
Ln 1, Col 11 line0 BUTF-8

Paste, drop or open a file in Input to see the result here.

Waiting for input
  • ⌘Enter Format
  • ⌘⇧M Minify
  • ⌘⇧C Copy result
  • ⌘F Find in result
  • Esc Exit full screen
  • Use Ctrl instead of ⌘ on Windows and Linux

How to format JSON

  1. Paste your JSON into Input, drop a .json file anywhere on the page, or press Open file.
  2. Pick the Indent: 2 spaces, 4 spaces, a tab, or Minified for a single line. Switch to Tree to browse nested data.
  3. Turn on Sort keys if you want a stable order for comparing two files.
  4. Select Copy (or press Ctrl+Shift+C) to put the result on your clipboard, or Download to save formatted.json.

The result updates as you type. If the input is not valid JSON, you see the problem and its line and column instead of a result. Fix the spot and the output returns.

What JSON is

JSON (JavaScript Object Notation) is the text format most web APIs, config files and databases use to exchange data. It has objects in curly braces, arrays in square brackets, strings in double quotes, numbers, true, false and null. It is strict: no comments, no trailing commas and no single quotes. That strictness is why a single missing quote can break a whole request.

When to use each style

  • Pretty-printed (2 or 4 spaces) is for reading, code review and documentation.
  • Minified removes every optional space and line break. Use it to shrink a payload or put JSON in a single environment variable.
  • Sorted keys make two versions of the same object easy to compare line by line.

Tips

  • Only checking syntax? Use the JSON validator, which also warns about duplicate keys.
  • Need a config file? Convert with JSON to YAML. Want types? Try JSON to TypeScript.
  • Looking for one value in a big file? Use a JSONPath query.
  • Sorting treats keys as plain text, so uppercase letters come before lowercase ones.
  • Keys that look like whole numbers, such as "10" and "2", always stay in numeric order, because that is how JavaScript objects work.
  • Unicode text such as Hindi, Arabic or emoji is kept exactly as written.

Privacy

API responses often hold personal data or secrets. This tool never sends your text anywhere. The formatting is done by your browser, on your device, and nothing is stored or logged.

Questions

Is my JSON uploaded to a server?

No. The formatter runs in your browser, so API responses, tokens and customer data stay on your device.

Why does it say my JSON is invalid?

The error message shows the line and column. The usual causes are a trailing comma, single quotes instead of double quotes, or an unquoted key.

Can it format very large files?

Yes. Large input is processed in a background thread so the page stays responsive, but a file of many megabytes may take a few seconds.

Does sorting keys change the meaning of the data?

Not for objects, because JSON objects are unordered. Arrays are never reordered.

Why did a long number change?

JSON numbers are read as 64-bit floats, so integers above 9,007,199,254,740,991 lose precision. Keep such IDs as strings.

More developer tools