Developer Tools

JSON Formatter & Validator

An API response is easier to inspect when object boundaries and nested arrays line up. Use this formatter to make a compact response readable or check a configuration before committing it. The formatter parses your input and serializes it with the selected indentation; the validator only reports whether parsing succeeds. Neither action checks a business schema or whether the values make sense for your application. Keep an original copy if exact numeric precision or duplicate property names matter.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Paste JSON, choose two or four spaces, then select Format. Use Validate to check syntax without replacing the output.

Example

Input

{"name":"Flutters","active":true}

Output

{
  "name": "Flutters",
  "active": true
}

What does this tool do?

JSON is a text format for objects, arrays and primitive values. Formatting changes whitespace, not the data structure.

Common mistakes and limitations

JSON requires double-quoted keys and strings. Trailing commas and comments are not supported. JavaScript numbers outside the safe integer range can lose precision.

Beautify for reading, minify for transport

Beautifying inserts indentation and line breaks between values so nested objects are easier to follow. Minifying removes that formatting when a compact representation is more useful. Neither operation compresses the data or changes what a consumer should read from valid JSON. Two spaces make deeply nested API responses easier to fit on a narrow screen; four spaces may match a repository convention. Use the same convention throughout a fixture instead of hand-aligning each key.

{"items":[{"id":1}]}

{
  "items": [
    {
      "id": 1
    }
  ]
}

Reading a validation error

An object uses braces and named properties; an array uses square brackets and ordered values. JSON property names must be in double quotes, even when a JavaScript object literal would allow an unquoted name. Strings also use double quotes. A comma separates entries but cannot follow the final entry. true, false and null are lowercase literals. Functions, undefined and comments belong to other languages, not JSON. When parsing fails, inspect the character before the reported position as well as the position itself.

Escapes, strings and exact values

A quote inside a string needs an escape, and a literal backslash needs a second backslash. Newlines inside a JSON string must be represented with an escape rather than an unescaped line break. A formatter does not repair these errors automatically because guessing can change the intended value. Large numeric identifiers should be strings if they must remain exact. For structural validation such as required fields and allowed types, use a separate JSON Schema check in your application.

{"message":"He said \"hello\"","path":"C:\\data"}

Review the data after formatting

Follow one object from its opening brace to its closing brace, then check that arrays contain the intended number of items. Formatting can make an accidental nesting level obvious without proving the values are correct. If you plan to generate Dart models, use a sample that includes nullable fields and representative list elements. If you need YAML configuration, convert the validated JSON next and review scalar types again.

Frequently asked questions

Can I format a JavaScript object?

Only valid JSON is accepted. Quote property names and remove functions, comments and undefined values.

Related tools