File Format Wiki

JSON format rules

Strict object/array data format used by APIs and config files.

Format rules

  • Double-quoted keys and strings only
  • No comments
  • No trailing commas

Valid example

{"ok":true,"items":[1,2]}

Invalid example

{ok:true,}

{ "a": undefined }

Common errors

  • Assuming JSON accepts syntax from a similar format
  • Using the wrong encoding or line ending
  • Copying invisible characters from rich text
  • Testing only the happy path and not parser errors

Online validation and conversion

Compared with nearby formats

JSON should be chosen for the parser and ecosystem that will consume it. Prefer strict formats for APIs, human-friendly formats for ops config, and signed formats only when verification is required.