JSON Formatter & Validator

Pretty print, minify, escape, unescape, and validate JSON with instant feedback and clear error locations so you can clean and check payloads fast.

Validation Status

Waiting for input

Paste JSON or load a sample to run syntax validation.

Input JSON

Paste raw JSON text. Use "Sample JSON" if you want to test the tool quickly.

Output

Tree view is available in Pretty mode. Expand or collapse nested nodes as needed.

Formatted tree will appear here.

How to use

  1. Paste your JSON into the input box.
  2. Choose Pretty, Minify, Escape, or Unescape.
  3. Copy the result or fix syntax errors shown by the validator.

Examples

Valid JSON input

A simple valid object that can be formatted or minified.

{
  "name": "Alice",
  "roles": ["admin", "editor"]
}

Invalid: trailing comma

Trailing commas are not valid in strict JSON.

{
  "name": "Alice",
  "age": 30,
}

Pretty output

Pretty mode keeps indentation and line breaks for readability.

{
  "service": "toolbye",
  "status": "ok",
  "count": 2
}

Minified output

Minify mode removes non-essential whitespace.

{"service":"toolbye","status":"ok","count":2}

Escaped output

Escape mode converts JSON text into embeddable escaped content.

{\"event\":\"page_view\",\"path\":\"/json\",\"meta\":{\"source\":\"toolbye\"}}

Unescaped output

Unescape mode restores escaped content back to readable JSON text.

{"event":"page_view","path":"/json","meta":{"source":"toolbye"}}

Common JSON Errors

Trailing commas

JSON does not allow a comma after the last item in an object or array.

Single quotes instead of double quotes

JSON keys and string values must use double quotes.

Comments in JSON

JavaScript-style comments are not part of the JSON specification.

Missing commas between properties

Object properties and array items must be separated by commas.

Unescaped characters

Special characters in strings must be escaped correctly, such as quotes and backslashes.

JSON vs JSON5

This tool uses strict JSON parsing through JSON.parse. It follows the official JSON rules used by most APIs and backend validators.

JSON5 conveniences like comments, trailing commas, and unquoted keys are not accepted here. If your input uses JSON5 features, convert it to strict JSON before formatting.

Does this tool send data to a server?

In the current implementation, JSON parsing and formatting happen in your browser during normal tool usage. The formatter does not require calling a JSON processing API.

Baidu Tongji script is enabled for aggregated visit analytics. JSON parsing and formatting still run locally in your browser.

Use Cases

API debugging

Validate request and response payloads before sending them to backend services.

Reading nested structures

Use pretty mode and tree view to inspect deeply nested objects and arrays.

Preparing compact output

Switch to minify mode when you need lightweight JSON for transport and storage.

Checking copied JSON before sharing

Run a quick syntax check before sharing snippets with teammates or documentation.

Frequently Asked Questions

Does this support JSON5?

No. This tool is strict JSON only and rejects JSON5 syntax such as comments and trailing commas.

Why is my JSON invalid?

Common causes include trailing commas, single quotes, missing commas, and invalid escape sequences.

What is the difference between Pretty and Minify?

Pretty keeps indentation and line breaks for readability. Minify removes extra whitespace to reduce payload size.

Is my JSON uploaded anywhere?

Normal formatting and validation run in your browser in the current implementation.

Can I use this for large files?

Yes, but performance depends on your browser and device memory. Extremely large payloads can still be slow.

Why do I see line and column numbers?

The parser returns error positions so you can jump directly to the broken part of your JSON.

What is the difference between Minify and Escape?

Minify removes unnecessary whitespace from JSON data. Escape converts text into escaped string content for embedding in code or payloads.

Why does Unescape report an error?

The input is not a valid escaped JSON string. Check quote wrapping and backslash escape sequences before retrying.

Common JSON Scenarios

JSON vs JSON5 Differences

Understand core JSON and JSON5 rule differences, and why some payloads fail strict JSON validation.

JSON Format Error Online Checker

Quick online JSON checking page to validate syntax and locate format errors fast.

How to Fix JSON Validation Errors

Common JSON error patterns and quick repair steps for invalid payloads.

Related Tools

Base64 Encode / Decode

Convert text and image payloads to and from Base64.

Timestamp Converter

Convert Unix timestamps and date-time values.

JSON Minifier

Coming soon

Dedicated minifier-focused workflow for large payload cleanup.

Not available yet

JSON Validator

Coming soon

Focused validator view with error diagnostics and troubleshooting hints.

Not available yet

URL Encoder / Decoder

Coming soon

Encode or decode URL query strings and parameter values.

Not available yet