100% Free No Signup Client-Side Only

JSON Formatter & Validator

Format, validate, and fix JSON errors instantly. No signup required.

Advertisement · 728×90 Banner
Input JSON 0 chars
Formatted Output 0 chars

                
Advertisement · In-Content Responsive

JSON Structure: Objects, Arrays, and Values

JSON is built on two universal structures and six data types. Every piece of valid JSON you will ever see is just a combination of these parts nested together. On the left is a real example that uses every JSON type at once — the labels on the right show what each piece is called.

{
  "user": {                 ← object (nested)
    "name": "Ada Lovelace",  ← string
    "age": 36,              ← number
    "active": true,         ← boolean
    "skills": [              ← array
      "math",
      "cs"
    ],
    "manager": null          ← null
  }
}
ObjectA set of "key": value pairs wrapped in { }. Keys must be unique strings.
ArrayAn ordered list of values wrapped in [ ]. Items can be mixed types.
StringAny text in double quotes — e.g. "hello".
NumberInteger or decimal, never quoted — e.g. 42, 3.14, -7.
BooleanLowercase true or false. No quotes.
NullLowercase null means "no value". Not the same as "" or 0.

JSON Syntax Rules (The Non-Negotiables)

These are the character-level rules JSON parsers enforce. Break any one of them and JSON.parse() will throw. Read them once and you'll avoid 95% of "invalid JSON" errors.

  • Keys must use double quotes"name": "John" is valid.
  • Single quotes are invalid'name': 'John' will fail to parse.
  • Separate pairs with commasEach "key": value pair is divided by a comma.
  • No trailing commasNo comma is allowed after the last item in { } or [ ].
  • Use a colon between key and valueAlways : — never =.
  • Keys cannot be unquoted{ name: "John" } is JavaScript, not JSON.
  • Booleans and null are lowercasetrue, false, null.
  • No undefined, NaN, or InfinityThese JavaScript values have no JSON equivalent.
  • Numbers are never quoted"age": 36 — not "36".
  • No comments allowedJSON has no // or /* */. Strip them before parsing.

Validate Your JSON Instantly

Paste your JSON below. We'll tell you if it's valid and explain any errors in plain English — with the exact line, column, and a human-readable hint. For large documents, use the full formatter at the top.

Correct JSON Format Examples

Real-world JSON file format example snippets you can copy, edit, or load straight into the formatter above. Each template follows every rule in the syntax guide and is ready to use in APIs, config files, or databases.

Valid vs. Invalid JSON

The best way to learn what a valid JSON example looks like is to see it side-by-side with the most common mistakes. Both snippets below contain the same data — only one parses successfully.

Valid JSON ✓
{
  "name": "Ada Lovelace",
  "skills": ["math", "cs"],
  "active": true
}
All keys use double quotes, there is no trailing comma, and every value is a legal JSON type. This will parse without errors.
Invalid JSON ✗
{
  'name': "Ada Lovelace",
  "skills": ["math", "cs",],
  "active": true,
}
Three problems: the key 'name' uses single quotes, there is a trailing comma after "cs" inside the array, and another trailing comma after true. Any one of these will throw a parse error.
Valid JSON ✓
{
  "price": 19.99,
  "currency": "USD"
}
Numbers are written without quotes. Strings are quoted. Clean and parseable.
Invalid JSON ✗
{
  price: 19.99,
  "currency": USD
}
The key price is unquoted, and the value USD is missing its string quotes. JSON keys must always be wrapped in double quotes, and string values must be too.