Programming tool
JSON Formatter & Validator
Check JSON syntax, make it readable, or compress it for use in an API request. Everything runs locally in your browser.
Formatted output will appear here.Paste JSON to begin.
Processed locally in your browser. Your JSON is not uploaded.
What is JSON?
JSON, or JavaScript Object Notation, is a text format for representing structured data. It uses objects with name-value pairs and arrays, plus strings, numbers, booleans, and null. Despite the name it is language-independent, and it is the default format for REST APIs, configuration files such as package.json, and data exchange between services.
What does a JSON formatter do?
A formatter parses valid JSON and adds indentation and line breaks so nested data is easier to inspect. Minifying reverses that presentation by removing unnecessary whitespace, which is useful when the JSON is going into an API request, a query string, or an environment variable.
This tool offers three actions. Format pretty-prints with two spaces per level and color-codes keys, strings, numbers, booleans, and null in the output. Minify collapses the same data onto a single line. Validate checks the syntax and reports the result without changing the text. All three use the browser's built-in JSON.parse and JSON.stringify, so the output is exactly what JavaScript itself would produce.
Formatting vs. validation
Validation answers whether the text follows JSON syntax. Formatting can only happen after parsing succeeds, so a failed format is also a useful validation signal. Neither action changes the meaning of valid data.
When parsing fails, the tool shows the parser's own message together with the character position where it stopped, for example a message about an unexpected token near character 42. Counting to that position in the input usually lands on or just after the mistake.
Common JSON syntax errors
Check for double quotes around property names and strings, commas between items, no trailing commas, and matching braces and brackets. JSON also requires lowercase true, false, and null.
- Single quotes around keys or strings – JSON only allows double quotes
- A trailing comma after the last item in an object or array
- Unquoted property names such as {name: 1} instead of {"name": 1}
- Comments – JSON has no comment syntax, unlike JavaScript or JSON5
- Capitalized True, False, or NULL, or values such as NaN, Infinity, and undefined
- Numbers with a leading zero or a trailing decimal point, such as 007 or 5.
Frequently asked questions
Is my JSON uploaded anywhere?
No. This tool uses your browser's built-in JSON parser and does not send your input to a server.
What is the default indentation?
Valid JSON is pretty-printed with two spaces per level.
Can JSON use single quotes?
No. Standard JSON requires double quotes for strings and object keys. Single quotes are valid in some programming languages, but not in JSON.
Does formatting change the order of keys or the values?
No. Keys stay in the order they were parsed and every value is preserved. The only exception is very large or very precise numbers, which JavaScript stores as 64-bit floating point and may round, for example 12345678901234567890 becomes 12345678901234567000.
Why is my JSON valid in JavaScript but rejected here?
JavaScript object literals are more permissive than JSON. They allow single quotes, unquoted keys, trailing commas, comments, and values such as undefined. JSON accepts none of these, so the same text can run as code yet fail as JSON.