Skip to main content
Screendesk
Free tool

JSON Formatter & Validator

Format, minify, and validate JSON with exact error positions and plain-English fixes. Everything runs in your browser.

Open source on GitHub

Input

Output

Formatted JSON appears here as you type.

Runs entirely in your browser. Nothing you paste here is uploaded or stored.

Common errors

Why your JSON is invalid. The mistakes behind most parse errors, and how to fix them.

Common JSON syntax errors
ErrorExampleFix
Trailing comma{"a": 1, "b": 2,}Remove the comma after the last item in an object or array.
Single quotes{'name': 'Ada'}Use double quotes for every string and property name: {"name": "Ada"}.
Unquoted keys{name: "Ada"}Wrap property names in double quotes. JSON is stricter than JavaScript object literals.
Comments{"a": 1 // note}JSON has no comment syntax. Remove // and /* */ comments, or use a "_comment" field.
Non-JSON values{"a": undefined, "b": NaN}Use null, a number, or remove the property. Python’s True/False/None become true/false/null.
Raw line breaks{"msg": "line one line two"}Escape line breaks inside strings as \n.
Several documents{"a": 1} {"b": 2}Newline-delimited JSON (NDJSON) is one document per line. Wrap them in an array to validate together.
Reference

JSON data types. The six value types the format allows.

JSON data types
TypeExampleRules
String"text"Double quotes only. Escape " \ and control characters.
Number42, -3.5, 1e9No leading zeros, no leading +, no hex, no NaN or Infinity.
Booleantrue, falseLowercase only.
NullnullLowercase only. There is no undefined in JSON.
Object{"key": value}Keys must be strings. Duplicate keys are allowed by the spec but the last one wins in most parsers.
Array[1, "two", null]Ordered values of any type, separated by commas.
FAQ

Frequently asked questions

How do I format JSON?

Paste your JSON into the input box. It is validated and pretty-printed as you type with 2 spaces, 4 spaces, or tabs. Switch to Minify to remove all whitespace, and turn on Sort keys to order object keys alphabetically, which makes two payloads easier to compare.

How does the JSON validator find errors?

The validator follows the JSON standard (RFC 8259) strictly and reports the line and column of the first problem, with the offending line shown and a caret under the error. It also explains common causes such as trailing commas, single quotes, unquoted keys, comments, and values like undefined or NaN.

Is my JSON uploaded anywhere?

No. Formatting and validation run entirely in your browser with JavaScript. Nothing you paste is sent to a server or stored, so it is safe to use with API responses that contain customer data, though you should still avoid sharing secrets.

Why did a large number change after formatting?

JavaScript stores numbers as 64-bit floating point, so integers larger than 9,007,199,254,740,991 (2^53 − 1) lose precision when parsed. If your payload contains big IDs, have the API send them as strings.

What is the difference between JSON and a JavaScript object?

JSON is a text format based on JavaScript object syntax but stricter: keys and strings need double quotes, trailing commas and comments are not allowed, and only strings, numbers, booleans, null, objects, and arrays are valid values. Functions, undefined, dates, and NaN are not.

Customer support runs on Screendesk.

Start for free