Quick Reference

JSON Cheat Sheet

Every JSON syntax rule, data type, and common mistake on a single page. Bookmark it, print it, share it with your team.

Data Types

String
"hello world"

Double quotes only, never single

Number
42, -3.14, 1.2e10

No leading zeros, no quotes

Boolean
true, false

Lowercase, no quotes

Null
null

Lowercase, represents empty value

Object
{ "key": "value" }

Unordered key/value pairs

Array
[1, 2, 3]

Ordered list, mixed types allowed

Syntax Rules

  • Keys must be strings wrapped in double quotes
  • Strings use double quotes (") — single quotes are invalid
  • No trailing commas after the last element
  • No comments (// or /* */) are allowed
  • No undefined, functions, or dates as native types
  • Numbers cannot have leading zeros (01 is invalid)
  • The top-level value can be an object, array, string, number, boolean or null
  • Whitespace between tokens is ignored

Common Mistakes (Invalid vs Valid)

{ name: "John" }
{ "name": "John" }

Keys need double quotes

{ 'name': 'John' }
{ "name": "John" }

Use double, not single quotes

{ "age": 30, }
{ "age": 30 }

No trailing comma

{ "x": undefined }
{ "x": null }

undefined is not valid JSON

{ "n": 01 }
{ "n": 1 }

No leading zeros

{ "v": .5 }
{ "v": 0.5 }

Digit required before decimal

Escape Sequences

\"Double quote
\\Backslash
\/Forward slash (optional)
\nNew line
\ Tab
\rCarriage return
\Backspace
\ Form feed
\uXXXXUnicode character (hex)

Complete Example

{
  "id": 123,
  "name": "John Doe",
  "isActive": true,
  "balance": 1500.50,
  "middleName": null,
  "roles": ["admin", "user"],
  "address": {
    "city": "Paris",
    "zip": "75001"
  },
  "tags": [],
  "lastLogin": "2026-01-15T10:30:00Z"
}

Frequently Asked Questions

Can JSON have comments?

No. The JSON specification does not allow comments. For config files that need comments, use JSONC or YAML, or add a dedicated property such as "_comment".

Does JSON support single quotes?

No. All strings and keys must use double quotes. Single quotes will cause a parsing error.

What data types does JSON support?

String, number, boolean, null, object and array. It does not have native types for dates, undefined, or functions.

Are trailing commas allowed in JSON?

No. A comma after the last element of an object or array is invalid and will fail to parse.

What is the difference between JSON and a JavaScript object?

JSON is a text format with stricter rules: keys must be quoted strings, only double quotes are allowed, and there are no functions, comments, or trailing commas.

Put This Cheat Sheet to Work

Use our free online tools to format, validate and fix your JSON instantly. No signup required.

Learn More

10 Common JSON Errors

Detailed fixes for the most frequent JSON syntax errors.

Read guide
JSON Best Practices

Naming conventions, structure and security tips for JSON.

Read guide