{ }

JSON Pretty, Minify and Validate

Expand JSON into an indented tree, squash it to one line, and locate parse errors
JSON 📂 Developer 👤 ToolWorld 🏷️ v1.4.0
Loading...
JSON inputPaste or type the text to process

ResultCopy or download it

Enter content, then press Run

Shape and size

Enter content, then press Run

How to Use

📖 Overview


JSON shows up everywhere: API responses you need to read, config files you need to tidy, log lines you need to make sense of. Servers usually return one long line with no line breaks, which is readable by a machine and by nobody else; hand-written config picks up a stray comma or a missing quote and only blows up once something else tries to parse it. This tool covers all three jobs in one place: expand a flattened string into an indented tree you can actually read, squash an indented document back onto a single line to save bytes before shipping it, and check whether a piece of text is genuinely valid JSON without altering a single character. The three modes share one input box, so you can flip between them without re-pasting. Everything runs locally in the browser: no request leaves the page, no text is stored, and you can paste production payloads containing tokens or personal data without a second thought. That local-only behaviour is deliberate rather than a limitation, and it means the tool keeps working with no network at all.

✨ Features


  • Three modes share one input: pretty-print into an indented tree, minify to a single line, or validate only and report pass or fail with no rewrite
  • Indentation of 2 spaces, 4 spaces, tab or none at all, with LF or CRLF line endings so the output matches whatever your project lint rules expect
  • On a parse error it reports the line and column and prints 30 characters either side of the failure, so you never count characters by hand to find a missing brace
  • Object keys can be sorted alphabetically, which helps when diffing two configs or building a stable string to sign, and works recursively through nested objects and arrays
  • Non-ASCII characters can be escaped to \\uXXXX form for systems that choke on raw UTF-8, or stripped out entirely when you only want the ASCII skeleton
  • Structural statistics: nesting depth, total key count, number of objects and arrays, plus a breakdown of how many strings, numbers, booleans and nulls the document holds

🚀 How to use


  1. Paste your JSON into the input box, or load the sample to see how each mode behaves on a small document
  2. Pick pretty-print, minify or validate-only from the dropdown, depending on whether you want to read it, shrink it or check it
  3. In pretty mode choose an indent width and a line ending; these two controls have no effect in minify or validate mode
  4. Optionally tick key sorting, Unicode escaping or non-ASCII stripping, then decide whether the change suits your document
  5. Press Run, read the statistics panel on the right, then copy the result or download it as a .json file

⚠️ Notes


  • Standard JSON only: single quotes, trailing commas, comments and undefined are all invalid and will raise an error. That comes from the specification, not from any limitation of this tool, so fix the source rather than expecting it to be accepted
  • Big number precision: integers beyond 2^53 lose precision once parsed as JavaScript numbers, so output may differ from the source. Keep order ids, snowflake ids and similar long integers as strings if the exact digits matter
  • Key sorting rewrites content: enabling it reorders keys recursively. If the order carries meaning, for instance in a template that renders fields sequentially, leave it switched off
  • Stripping non-ASCII is irreversible: that option deletes CJK characters, emoji and anything else outside ASCII. It is destructive, so undo afterwards or work on a copy
  • Empty input gives no result: running with a blank box shows a prompt to enter content rather than returning an empty string, and changing any control after a successful run invalidates the displayed result until you press Run again

Related

⏫︎