Skip to content
EduVerse

JSON

In depth

Protocol / format

Also known as: JavaScript Object Notation

Lightweight data-interchange format and the standard for API communication on the web.

JSON, explained

Written by EduVerse

What it is

JSON (JavaScript Object Notation) is a text format for structured data. It has just a few building blocks: objects in curly braces with keys and values, arrays in square brackets, strings, numbers, true, false and null. Its syntax comes from JavaScript, but almost every language can read and write it.

Why teams use it

Systems written in different languages need a shared way to pass data around. JSON is quick to learn, readable by people and supported in practically every language. Compared with XML it’s shorter and maps directly onto objects and arrays, though it allows no comments and has no date type.

An example from work

Your fetch call fails with a SyntaxError about an unexpected token “<” when you call response.json(). The server didn’t send JSON at all: it returned an HTML page, and that < is the start of <!DOCTYPE html>. The Network tab shows the real cause, often a wrong URL or a server error.

Our own explanation, not a quote from the book.

In the book

Sentences from The Software Realm, Decoded that mention JSON, exactly as printed.

    1 more passages about JSON in the full book

    Read every conversation where JSON comes up, with the interactive slides and demos.

    See the book

    Where it fits

    Data format for REST APIs and configuration files

    Coverage in the book

    In depth

    Covered in depth: multiple pages with explanations, examples and simulations.

    Appears in