Skip to main content

JavaScript Object Notation (JSON)

PropertyValue
descriptionJavaScript Object Notation (JSON)
tagsref
rating

Overview

JSON, short for JavaScript Object Notation, is a text-based format for representing structured data.

It matters because it has become one of the default formats for APIs, configuration files, event payloads, and machine-to-machine data exchange.

What JSON Is Good At

JSON is designed to be simple for humans to read and straightforward for software to parse.

It represents data using a small set of building blocks:

  • objects made of key-value pairs
  • arrays of ordered values
  • strings
  • numbers
  • booleans
  • null

That simplicity is one reason it shows up so often in api and rest-api work.

Common Uses

JSON is commonly used for:

  • API requests and responses
  • application configuration
  • structured logs and messages
  • export and import payloads
  • data exchanged between frontend and backend code

It is especially common in JavaScript-heavy stacks, but it is not limited to js applications.

JSON vs JavaScript Objects

JSON came from the JavaScript ecosystem, but JSON is not the same thing as a general JavaScript object literal.

  • JSON has stricter syntax rules.
  • Property names must use double quotes.
  • Trailing commas are not allowed.
  • Functions and comments are not part of the format.

That distinction matters because files that look close enough to JavaScript may still be invalid JSON.

JSON vs YAML

JSON is often compared with yaml.

  • JSON is more explicit and usually easier for machines to validate consistently.
  • YAML is often easier for humans to scan in configuration files.

Teams often choose JSON when strictness and interoperability matter more than authoring comfort.

Practical Caveats

JSON is widely supported, but it has limits.

  • It does not support comments in the standard format.
  • Large documents can become hard to read manually.
  • It does not preserve richer data types such as dates by itself.
  • Schema validation is separate from the base format.

That is why teams often pair JSON with conventions, schemas, or typed models.

Frequently Asked Questions

Is JSON only for JavaScript?

No. It is language-neutral and widely used across many ecosystems.

Can JSON contain comments?

Not in the standard format defined by the official specifications.

Is JSON a markup language?

Not usually. It is a data serialization format rather than a document markup format like html or xml.

Resources