YourTools.
简体中文
Back to the catalog
Tools

JSON format and validate

Format, minify or sort JSON, repair common mistakes, or escape it as a string. Errors show the line and column, and large numbers keep every digit.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Operation, Indent, Sort keys

JSON format and validate

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Format, validate, minify or repair JSON. Use it to make a minified API response readable while you debug, to find the exact line and column of a syntax error in a config file, or to turn a piece of JSON into an escaped string you can put in code.

Numbers keep every digit, so long IDs such as 12345678901234567890 and values like 1.50 are not rounded or rewritten. Up to 1 MB of text is processed right in your browser, and nothing is uploaded to a server.

How to use it

  1. Type or paste your JSON, or select Use example to load a sample with a long number.
  2. Pick an “Operation”: “Format”, “Minify”, “Repair and format”, “Escape as a string” or “Unescape a string”. For formatted output, choose the “Indent” and whether to “Sort keys”.
  3. Select Run. If the JSON is invalid, the error names the line and column.
  4. Preview the result, then download it as a JSON file, or as a text file for escaped and unescaped strings.

Formats and limits

Input
Text
Output
JSON, Plain text
Size limit
1 MB
Settings
Operation (Format, Minify, Repair and format, Escape as a string, Unescape a string); Indent (2 spaces, 4 spaces, Tab); Sort keys
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

Will large numbers lose precision?

No. Standard JavaScript parsing loses precision for integers above 9007199254740991, but this tool keeps every number exactly as written, including trailing zeros such as 1.50.

How do I fix trailing commas, single quotes or comments?

Strict JSON does not allow them, so “Format” stops with an error. Choose “Repair and format”: it removes trailing commas and comments, adds quotes around bare keys, turns single quotes into double quotes and closes brackets missing at the end.

Why does it report a duplicate key?

When the same key appears twice in one object with different values, the tool reports it instead of silently keeping one of them. Rename or remove one of the keys and run again.

What do “Escape as a string” and “Unescape a string” do?

Escaping turns the text into the inside of a JSON string: quotes, backslashes and line breaks become \", \\ and \n, while non-ASCII characters such as Chinese stay as they are. Unescaping does the reverse and accepts the text with or without the surrounding quotes.

Does “Sort keys” change the order of arrays?

No. Keys are sorted in every nested object, by character code, so uppercase letters come before lowercase ones. Array items keep their order.

Workflows that use this tool