Developer Cheat Sheet

JSON Syntax Cheat Sheet

Every JSON value type, object and array syntax, nesting rules, and the most common syntax mistakes that break valid-looking JSON.

Brekzy Team Published September 5, 2026

On this page
  1. The Six JSON Value Types
  2. Object Syntax
  3. Array Syntax
  4. Nesting Objects and Arrays
  5. Common Syntax Mistakes

The complete JSON syntax in one page: the six value types, nesting rules, and the mistakes that break valid-looking JSON most often. Paste anything questionable into the JSON Formatter & Validator to check it instantly.

The Six JSON Value Types

Type Example Notes
String "hello" Always double-quoted, never single-quoted.
Number 42, 3.14, -7 No quotes. No leading zeros (e.g. 0123 is invalid).
Boolean true, false Lowercase, unquoted.
null null Lowercase, unquoted. Represents “no value.”
Object {"key": "value"} Unordered key/value pairs, keys always double-quoted strings.
Array [1, 2, 3] Ordered list of any JSON values, including mixed types.

Object Syntax

An object is a comma-separated list of "key": value pairs inside curly braces:

{"name": "Ava", "age": 29, "active": true}

Array Syntax

An array is a comma-separated list of values inside square brackets, in a fixed order:

["red", "green", "blue"]

Array elements don’t have to be the same type: [1, "two", true, null] is valid JSON.

Nesting Objects and Arrays

Objects and arrays can contain other objects and arrays, to any depth:

{"user": {"name": "Ava", "roles": ["admin", "editor"]}}

Common Syntax Mistakes

Mistake Invalid Valid
Trailing comma {"a": 1, "b": 2,} {"a": 1, "b": 2}
Single-quoted strings {'a': 'b'} {"a": "b"}
Unquoted keys {a: 1} {"a": 1}
Comments {"a": 1 // note} JSON has no comment syntax at all
Leading zero {"n": 007} {"n": 7}
NaN / undefined {"n": NaN} {"n": null}
Try it yourself

JSON Formatter & Validator

Try our JSON Formatter & Validator →

Frequently Asked Questions

Can JSON have comments?

No. Standard JSON has no comment syntax at all — not //, not /* */. Some tools accept a relaxed superset (JSON5, JSONC), but plain JSON parsers will reject them.

Do JSON object keys need to be in a specific order?

No. JSON objects are unordered collections of key/value pairs — most parsers preserve insertion order in practice, but the JSON specification itself does not guarantee or require it.

Can a JSON array mix different types?

Yes. An array like [1, "two", true, null, {"a": 1}] is completely valid JSON.

Explore More

Find the right tool, or browse Brekzy's other resources.