JSON Syntax & Data Types

Explore the 6 core data types in JSON and the strict syntax rules governing keys and values.

Interactive Tool: Practice in real-time with Pixlint's free browser-based JSON Validator. No data is uploaded.
Open tool →

JSON supports exactly six basic data types. Any valid JSON document must consist of these types nested within an object or an array.

The 6 Primitive Data Types

  1. String: Sequence of Unicode characters wrapped strictly in double quotes ("hello"). Single quotes are invalid!
  2. Number: Integer or floating-point numbers (e.g. 42, -3.14, 1.2e5). Hexadecimal (0x1F) and leading zeroes (007) are forbidden.
  3. Boolean: Either literal true or false in lowercase.
  4. Null: Literal null representing an empty or non-existent value.
  5. Object: An unordered collection of key/value pairs enclosed in braces {}. Keys must be double-quoted strings.
  6. Array: An ordered sequence of values enclosed in square brackets [].

Common JSON Syntax Pitfalls

  • Trailing Commas: JSON forbids trailing commas in arrays or objects: {"a": 1,} is invalid.
  • Single Quotes: {'name': 'Alex'} causes a parse error; double quotes are required.
  • Comments: Standard JSON does not support comments (// or /* */).