Skip to content
UtiliaTools

What Is JSON? A Complete Guide to JavaScript Object Notation

JSON (JavaScript Object Notation) is a lightweight, text-based data format that has become the backbone of modern web APIs and configuration files. Understanding JSON is essential for any developer working with data.

The Origins of JSON

JSON was introduced by Douglas Crockford in the early 2000s as a lightweight alternative to XML for data exchange between browsers and servers. Despite its name, JSON is language-independent — virtually every programming language can parse and generate it.

JSON Structure and Syntax

JSON is built on two fundamental structures:

  • Name-value pairs: Similar to objects, dictionaries, or hash tables, data is stored as key-value pairs where keys must be strings wrapped in double quotes.
  • Ordered lists: Arrays hold sequences of values, separated by commas and enclosed in square brackets.

Values can be strings, numbers, booleans (true/false), null, objects, or arrays. Strings must use double quotes — single quotes are not valid JSON.

A Simple Example

{
  "name": "UtiliaTools",
  "version": 2,
  "isActive": true,
  "features": ["formatter", "converter", "generator"],
  "metadata": null
}

Common Use Cases

JSON is everywhere in modern software:

  • REST APIs: Most web APIs return JSON responses by default.
  • Configuration files: Tools like VS Code, npm, and TypeScript use JSON for settings.
  • NoSQL databases: MongoDB and CouchDB store documents in JSON-like formats.
  • Data logging: Structured logs in JSON format are easy to parse and search.

Syntax Rules to Remember

  1. Keys must be double-quoted strings.
  2. Trailing commas are not allowed.
  3. Comments are not supported in standard JSON.
  4. Numbers cannot have leading zeros (except 0.x).
  5. Strings support escape sequences like \n, \t, and \".

JSON vs XML vs YAML

While XML is more verbose and YAML more human-readable, JSON strikes a balance between simplicity and machine-parseability. It is the default choice for web APIs due to its native compatibility with JavaScript and compact size.

Frequently asked questions

Is JSON the same as a JavaScript object?

No. JSON is a text format, while a JavaScript object is a runtime data structure. You can convert between them using JSON.parse() and JSON.stringify().

Can JSON contain functions or dates?

Not natively. JSON supports only strings, numbers, booleans, null, arrays, and objects. Dates must be stored as strings, and functions are not supported.

Why are comments not allowed in JSON?

JSON was designed for machine-to-machine data exchange, not human configuration. The specification intentionally omits comments to keep parsing simple and unambiguous.

Related guides

Try the tool

Use our free tool to get started instantly.

JSON Formatter & Validator →

Last updated on 2026-09-27