Skip to content
uencoder

JSON

JSON (JavaScript Object Notation) is a lightweight data interchange format based on JavaScript object literals, using key-value pairs and arrays.

Purpose

To provide a language-neutral, human-readable, easy-to-parse data interchange format, replacing XML as the dominant Web API format.

Mechanism

It builds on two structures: collections of key-value pairs (objects {}) and ordered lists (arrays []). Values are strings (double quotes), numbers, booleans, null, objects, or arrays. The syntax is strict (double quotes, no trailing commas, no comments). RFC 8259 requires UTF-8 and forbids a BOM.

Use cases

  • Web API requests and responses
  • Configuration files (package.json, tsconfig)
  • NoSQL document storage (MongoDB)
  • Log and event data

Examples

  • Input
    {"name":"Ada","age":36}
    Output
    The object {name:"Ada", age:36}

    Keys must be double-quoted

Common errors

Using single quotes or unquoted keys (invalid JSON)
Keys and string values must use double quotes

Related terms

Related tools

Related tutorials

References