JSON Formatter and Validator

Validate JSON and change its whitespace without rewriting keys, strings or number tokens.

Input stays in this browser tab. Limit 200,000 characters.

Diagnose invalid JSON and preserve the exact values you received

Find the difference between JSON and JavaScript syntax

JSON values can be objects, arrays, strings, numbers, true, false or null. Property names and string values use double quotes. JavaScript source allows expressions, comments and some other conveniences that JSON parsers reject. See ECMA-404’s definition of JSON syntax.

Test a minimal example around the broken field. If a string contains a quote or a literal line break in your application, the serialized JSON needs an escape such as \" or \n. Use the table to tell a syntax failure from a type or interoperability issue.

How to diagnose a JSON import
InputWhy it fails or surprisesWhat to check
{item: "A"}Unquoted property name{"item":"A"}
["A",]Trailing comma after the final element["A"]
{"id":9007199254740993}Valid JSON. A binary64 consumer can round the number.Use a string for an exact identifier if your schema allows it.
{"active":true,"active":false}Valid syntax with an ambiguous repeated name.Resolve the duplicate before sending it to another program.

Check what downstream software does with the formatted document

Formatting retains the source number tokens, quoted escape sequences and repeated keys. An API, database or JavaScript program can interpret that document differently. RFC 8259 discusses repeated names and the interoperability limits of widely used binary64 number implementations.

When two systems disagree, compare the original and received copies before reserializing. Confirm the expected schema, field types and required keys separately. If the receiver needs a row-per-record format, use the CSV and JSON converter for flat records.

Editorial review

Calculation method

Format or compact an API response before comparing it or pasting it into a bug report. The formatter keeps original number tokens, escape sequences, object key order and repeated keys. It uses the parser to check syntax and outputs the original tokens rather than reserializing the object.

Validate the JSON grammar → retain each token → insert or remove structural whitespace.

Assumptions and limits

Syntax validation cannot verify a schema. Consumers may disagree on repeated keys or round large numbers. Comments and trailing commas are invalid in standard JSON. Format up to 200,000 input characters and 128 levels of nesting.