Skip to content
CheckcraftDownload
Practical workflow

JSON: what the format is, syntax rules, examples and common errors

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. Download, no sign-up →

JSON is a text format for exchanging data between programs. Every programming language reads it, so most APIs answer in it, settings are stored in it and logs are written in it. The format is simple: objects in curly braces, arrays in square brackets and six value types. Below are the rules, an example and the errors people hit most.

Checkcraft ·

Get help with your first test →

What JSON consists of

An object is a set of key: value pairs in curly braces; the key is always a string in double quotes. An array is an ordered list of values in square brackets. A value is a string, a number, true or false, null, another object or an array. Nesting is unlimited, which suits an order with items or a customer with addresses.

What JSON does not have

JSON has no comments, single quotes, unquoted keys or trailing commas. There is no date type: dates travel as strings, usually ISO 8601. Integers and decimals are not distinguished, and NaN and Infinity are forbidden. All of this is allowed in a JavaScript object, which causes most errors.

JSON check diagram: syntax, required fields, types, values, extra fields

Valid JSON is not yet a correct response

A syntax check only says the text can be parsed. It will not tell you the total is wrong, the status is not in the list or an internal field leaked. That takes content checks: a schema, field rules and calculations.

A JSON example

{
  "id": 5001,
  "status": "PAID",
  "createdAt": "2026-11-09T10:15:00Z",
  "customer": { "id": 7, "name": "Анна Петрова", "phone": null },
  "items": [
    { "productId": 101, "name": "Мышь", "quantity": 2, "price": 1290.0 },
    { "productId": 102, "name": "Кабель", "quantity": 1, "price": 590.0 }
  ],
  "subtotal": 3170.0,
  "discount": 300.0,
  "total": 2870.0,
  "gift": false
}

This is an order object: numbers have no quotes, strings use double quotes, a missing phone is null, and items are an array of objects. Indentation and line breaks are optional and only help people.

API call diagram: method and URL, headers, body, status and response body, logs and database

Value types

TypeExampleWatch out for
String"PAID"Double quotes only; escape quotes and backslashes: \" and \\
Number42, -3.14, 1e6No quotes or leading zeros; NaN and Infinity are forbidden
Booleantrue, falseLowercase only
NullnullNot the same as an empty string or a missing field
Object{"id": 7}Keys are double-quoted strings
Array[1, 2, 3]Order matters, types may differ

JSON, JavaScript object, XML and YAML

JSONJavaScript objectXMLYAML
CommentsNoYesYesYes
Quoted keysRequired, doubleOptionalTags instead of keysOptional
Trailing commaErrorAllowedn/an/a
Data typesSix typesPlus functions, dates, undefinedAll text, schema sets typesLike JSON plus dates
Where usedAPIs, logs, settingsCodeSOAP, documentsSettings, CI

Common JSON errors

ErrorWhat it looks likeMore
Trailing comma{"a": 1,}Unexpected token
Single quotes or unquoted key{'a': 1} or {a: 1}Unexpected token
An HTML page instead of JSON<!DOCTYPE html>…DOCTYPE is not valid JSON
Truncated or empty response{"items": [Unexpected end of JSON input
Generic parse failureJSON parse errorJSON parse error
A long number lost precision12345678901234567890 → …67000JSON formatter

What happens when a key repeats

The JSON standard does not forbid repeating a key in one object, so every library chooses which value to keep. On 25 November 2026 we ran one response through five parsers:

{"orderId":5002,"status":"PAID","amount":2970,"status":"CANCELLED"}
ParserResult
Python, json.loadsstatus = CANCELLED
Node.js, JSON.parsestatus = CANCELLED
Java, Jackson 2.17 defaultstatus = CANCELLED
Java, Jackson with STRICT_DUPLICATE_DETECTIONerror Duplicate field 'status'
Java, org.json 20231013error Duplicate key "status"

Two Java services reading this response disagree: one sees a cancelled order, the other throws, and nobody sees PAID. A schema check still passes. Only the raw text or a strict parser catches the repeat: object_pairs_hook in Python, STRICT_DUPLICATE_DETECTION in Jackson. This response is order 5002 in the practice API.

Tools to read and check JSON

All tools run in the browser and send nothing to a server.

All guides in the JSON section

Frequently asked questions

What is JSON?

A text format for exchanging data: objects in curly braces, arrays in square brackets, values are strings, numbers, true, false and null.

What data types does JSON have?

Six: string, number, boolean, null, object and array. Dates travel as strings.

Can JSON have comments?

No. JSON5 and JSONC allow them, but a standard parser fails.

JSON vs a JavaScript object?

JSON needs double-quoted keys and has no single quotes, comments, functions or trailing commas.

Next step

Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

Download FreeDownload and first run

No sign-up or email needed, the archive is ready in a couple of minutes. See the edition limits.

References

RFC 8259: the JSON format · json.org: format description

Start with the linked example and compare its result with your own test requirement.

Ask a person

Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

No account required. We will reply by email. This is a support request, not a newsletter subscription.