Developer guide

JSON for beginners: structure, validation, and common mistakes

JSON (JavaScript Object Notation) is a lightweight text format for structured data. APIs, config files, and no-code tools use it constantly — even if you never write JavaScript day to day.

Building blocks

  • Objects use curly braces and key/value pairs: {"name":"Amina"}
  • Arrays use square brackets: [1, 2, 3]
  • Values may be strings, numbers, booleans, null, objects, or arrays

Keys and strings must use double quotes. Single quotes are invalid in strict JSON.

A readable example

Beautified JSON is easier to audit:

{
{
  "product": "Toolspire",
  "tools": ["emi", "bmi", "json"],
  "free": true,
  "version": 1
}

Common mistakes

  1. Trailing commas after the last property
  2. Comments (JSON does not allow // comments)
  3. Unquoted keys
  4. Mixing single and double quotes
  5. NaN or undefined values (not valid JSON)

When an API response “looks fine” but a script fails, paste it into the Toolspire JSON Formatter. Validation errors usually point near the problem character.

Beautify vs minify

Beautify adds indentation for humans. Minify removes whitespace for smaller payloads. Both should represent the same data. Never minify by hand — use a tool so you do not accidentally delete a quote.

Security note

Treat untrusted JSON like untrusted input. Do not eval it as code. Prefer official parsers in your language. Be careful pasting secrets into any online tool; Toolspire formats locally in the browser, which is safer than uploading to unknown servers.

← All guides · Open JSON Formatter