JSON formatter

JSON formatter

Pretty-print / minify / validate JSON with error location

Computed in your browser

Paste JSON and choose Pretty-print, Minify or Validate. Represent large integers as strings when their exact digits must be preserved.

 

Example

Input

{"name":"Dayeku","items":[1,2]}

Example result

{
  "name": "Dayeku",
  "items": [
    1,
    2
  ]
}

Choose two-space indentation. Minifying removes structural whitespace, not spaces inside strings.

Technical details & limits

The tool uses JSON.parse and JSON.stringify. Standard JSON requires double-quoted keys and strings and disallows comments, trailing commas and undefined. Numbers use JavaScript Number, so integers beyond 2^53−1 may lose precision. Duplicate keys retain their last value; formatting is not byte-preserving.

About this tool

Validate, pretty-print or minify JSON with two spaces, four spaces or tabs. Inspect API responses, clean up configuration and locate syntax errors locally in the browser.

Use cases

  • Blow up a compact API response so you can read the field structure.
  • Minify a large config for use in an environment variable or URL.
  • Validate a JSON document and see where it fails.

How to use

  1. Paste JSON into the input box.
  2. Pick indent width: 2 spaces, 4 spaces or Tab.
  3. Click Pretty-print, Minify or Validate. Invalid input shows a syntax hint; when the browser provides an error position, the tool also shows line, column and nearby text.

Input & output

Input
Any JSON text. The tool does not accept JavaScript object literals.
Output
A normalised JSON string (pretty or minified).

Notes

Follows the JSON spec: no comments, no trailing commas. Numbers larger than JavaScript’s safe-integer range (2^53) may lose precision — carry them as strings if you need exactness.

FAQ

Does JSON support comments?
Not in the standard. Look at JSON5 or JSONC if you need them — this tool does not parse those extensions.
Why do my big integers change?
JavaScript's safe integers range from −(2^53−1) to 2^53−1. Values outside it may be inexact; store and transmit long IDs as strings.
Will Chinese characters become \uXXXX?
No — this tool emits UTF-8 as-is. For ASCII-safe output, use your own language’s JSON serialiser with escape option on.
How should I represent a long database ID in JSON?
Transmit IDs beyond JavaScript's safe-integer range as strings, for example "9223372036854775807". Formatting cannot restore precision already lost by parsing a number.
Does valid JSON mean an API payload is correct?
No. This checks JSON syntax, not API contracts, required fields, business limits or JSON Schema. Validate those against the receiving interface.

Related tools

JSON formatter · Pretty-print / minify / validate JSON with error location
JSON formatter — Tool illustration · dayeku.com