Your JSON

Result

Validated in your browser with the built-in JSON parser. Your data is not uploaded.

What a JSON formatter and validator does

JSON (JavaScript Object Notation) is the text format most web APIs, configuration files and apps use to exchange data. A formatter adds indentation and line breaks so nested data is easy to read; a minifier removes them to make the file smaller; a validator checks that the text follows the JSON rules and points to the first error.

How to use it

  1. Paste your JSON, for example an API response or a config file.
  2. Format or validate it. If the JSON is invalid, check the reported line and the line just before it; the real mistake is often one character earlier.
  3. Copy the cleaned result back into your code or file.

The most common JSON errors

  • Trailing comma: {"a": 1,} is invalid. Remove the last comma before } or ].
  • Single quotes: keys and strings must use double quotes: {"name": "Ali"}, not {'name': 'Ali'}.
  • Unquoted keys: {name: "Ali"} works in JavaScript but is not valid JSON.
  • Comments: // and /* */ are not allowed in standard JSON.
  • Special values: undefined, NaN and Infinity are not valid; use null or a number.
  • Unescaped characters: line breaks and double quotes inside strings must be written as \n and \".

JSON data types

JSON has six types: string ("text"), number (42, 3.14), boolean (true/false), null, array ([1, 2, 3]) and object ({"key": "value"}). Objects and arrays can be nested inside each other to any depth.

Privacy tip

API responses often contain tokens, emails or customer data. Remove secrets before pasting JSON into any online tool, and never share a formatted response that still contains an API key.