Guides / Concepts explained

What Is JSON? A Plain-English Guide with Examples

JSON is the simple text format apps use to send and store data. Learn its six value types, how to read it, common errors and how it shows up when you build.

Mythex Team · 2026-09-29 · 4 min read

JSON (JavaScript Object Notation) is a simple text format for writing down structured data — things like a customer, an order or a list of products — as names paired with values. It's easy for people to read and easy for programs to produce and parse. When apps and services exchange data over the web, JSON is by far the most common format.

Why JSON matters when you build with AI

You'll meet JSON constantly, even if you never write code:

  • APIs. When your app's screens load data from its backend, or your backend calls a payment, email or AI service, the data usually travels as JSON. See what an API is.
  • Settings files. Many project configuration files are JSON — for example package.json, which lists a JavaScript project's dependencies.
  • Databases. Postgres can store JSON in a column (the jsonb type) for data that doesn't fit neat rows and columns. See what Postgres is.
  • AI output. When you want an AI model to return something a program can use — a list of tags, extracted invoice fields — you usually ask for JSON.
  • Error messages and logs. Many errors arrive as JSON, and reading them is often the fastest way to find out what went wrong.

Being able to read JSON lets you check what your app actually received, spot a missing field and describe problems precisely to your AI builder.

An everyday analogy

Think of a paper form: Name: ____, Phone: ____, Newsletter: ☐ yes ☐ no. Every entry is a label with a value next to it. JSON is that form written as text, in a strict layout a computer can read without guessing. And like forms, JSON can have sections within sections (an address block with street, city and postcode) and lists (several phone numbers).

What JSON looks like

Here's a single booking in JSON:

{
  "id": 5001,
  "customer": "Lena Park",
  "service": "Haircut",
  "startsAt": "2026-10-03T14:00:00Z",
  "price": 35.5,
  "paid": false,
  "notes": null,
  "extras": ["beard trim", "hot towel"],
  "contact": {
    "email": "lena@example.com",
    "phone": "+44 20 7946 0000"
  }
}

Reading it:

  • Curly braces { } wrap an object — a set of name/value pairs.
  • Each pair is "name": value, separated by commas.
  • Square brackets [ ] wrap an array — an ordered list.
  • Objects and arrays can sit inside each other, as contact and extras do.

The six kinds of value

JSON only has six types of value. That small list is a big part of why it works everywhere.

TypeExampleNotes
String (text)"Lena Park"Always double quotes
Number35.5, -2, 1e6No quotes; no currency symbols
Booleantrue, falseLower case, no quotes
Nullnull"No value"
Object{ "city": "Leeds" }Named values
Array[1, 2, 3]Ordered list; items can be any type

There's no date type. Dates are written as strings, usually in the ISO 8601 format shown above (2026-10-03T14:00:00Z, where Z means UTC). Agreeing on that format avoids a whole category of time-zone bugs.

The strict rules (where errors come from)

JSON is less forgiving than it looks. These are all invalid:

{ name: "Lena" }            ← key without double quotes
{ 'name': 'Lena' }          ← single quotes
{ "a": 1, "b": 2, }         ← trailing comma
{ "a": 1 "b": 2 }           ← missing comma
{ "a": 1 // comment }       ← comments aren't allowed

Most "Unexpected token" errors you'll see are one of these. A JSON validator or formatter will show you the exact line.

A worked example: JSON through an app

A customer books a haircut in a salon app. Here's where JSON appears:

  1. The booking form sends this to the app's backend:
{ "service": "Haircut", "startsAt": "2026-10-03T14:00:00Z", "name": "Lena Park" }
  1. The backend saves the booking in the database and replies with status 201 Created and:
{ "id": 5001, "status": "confirmed" }
  1. If the time was already taken, it might instead reply with status 409 Conflict and:
{ "error": "slot_taken", "message": "That time was just booked. Please pick another." }

The page reads status or error and shows the right message. If the page showed a blank screen instead, opening the browser's developer tools (Network tab) would show you this JSON — often the quickest clue to what went wrong.

Key terms

TermMeaning
KeyThe name in a name/value pair, like "email".
ParseTurn JSON text into data a program can use.
Serialize / stringifyTurn data into JSON text to send or store.
PayloadThe data sent in a request or response.
SchemaA description of the shape data should have — which fields, which types. JSON Schema is a standard way to write one.
JSONBPostgres's binary JSON column type, which can be indexed and queried.
NDJSON / JSON LinesOne JSON object per line, common for logs and streaming.

Common misconceptions

  • "JSON is JavaScript." It came from JavaScript's syntax, but it's language-independent; Python, Java, C#, Go and the rest all read it.
  • "Numbers in quotes are fine." "35" is a string, not a number. Mixing them causes bugs like "35" + "5" becoming "355". Money is often better stored as whole cents (3550) to avoid rounding issues.
  • "JSON is secure because it's just data." JSON can carry anything, including secrets. Don't put API keys in JSON that's sent to the browser.
  • "Put everything in a JSON column." Handy for flexible extras, but data you search, filter or join on usually belongs in proper columns.
  • "The AI always returns valid JSON." Models can add extra text or break the format. Many providers offer a structured-output mode; your code should still check what comes back.

What to ask your AI builder

  • "Show me an example of the JSON this endpoint returns."
  • "Return errors as JSON with an error code and a human-readable message."
  • "Store dates as ISO 8601 strings in UTC and convert to local time only on screen."
  • "Store prices as integer cents."
  • "Validate incoming JSON on the server and reject requests with missing or wrong-typed fields."
  • "When calling the AI model, ask for JSON in this exact shape and check it before using it."

JSON in Mythex

You don't need to write JSON by hand in Mythex — you describe what you want and the agent writes the code that sends and reads it. It helps to recognise it, though: when something breaks, pasting the JSON error into chat gives the agent a precise clue. The docs' REST API backend recipe asks for "clear JSON errors" from the start, and the integrate any API recipe covers calling outside services. For the bigger picture, see REST vs GraphQL and how to debug an AI-built app.

Questions

What is JSON in simple terms?

JSON (JavaScript Object Notation) is a plain-text format for writing down structured data as names and values, like "name": "Lena". Almost every web API uses it to send data back and forth, and many apps use it for settings and stored data.

Is JSON a programming language?

No. JSON is a data format, not a language. It can't do anything on its own — it only describes data. Although it came from JavaScript, practically every programming language can read and write it.

What is the difference between JSON and a JavaScript object?

They look similar, but JSON is stricter. In JSON every key must be in double quotes, strings use double quotes, there are no comments, no trailing commas, and values are limited to strings, numbers, true, false, null, objects and arrays.

Why does my JSON say it is invalid?

The usual causes are a trailing comma after the last item, single quotes instead of double quotes, a missing comma between items, an unclosed bracket, or a comment. Paste it into a JSON validator and it will point to the line.

Keep reading

  • Frontend vs Backend: What's the Difference? — The frontend is what users see in the browser; the backend runs on a server and handles data, logic and security. How the two fit together, with an example.
  • How Domains and DNS Work: A Guide for Non-Developers — How domain names and DNS connect example.com to your app: registrars, nameservers, A, CNAME, MX and TXT records, propagation, and connecting a custom domain.
  • How to Use LLM APIs: Tokens, Costs, Keys and Your First AI Feature — What an LLM API is, how tokens, context windows and per-token pricing work, how to keep your API key safe, and how to add a first AI feature to your app.
  • Native Apps vs Progressive Web Apps: Which Do You Need? — Native apps vs progressive web apps (PWAs): what each can do, iPhone limits as of September 2026, costs, and how to choose for your first version.
  • REST vs GraphQL: What's the Difference and Which Should You Use? — REST and GraphQL are two ways to design an API. How each works, with examples, the real trade-offs, and which one makes sense for an app you build with AI.
  • SQL vs NoSQL: Which Database Should Your App Use? — SQL databases store data in linked tables; NoSQL databases use documents, key-values and more. The real differences, examples, and which one fits your app.

Start building free · Templates · Docs