Skip to content
ConvertMyStuff
Resource

What Is JSON?

JSON is a lightweight text format for structured data—arrays, objects, strings, numbers, booleans, and null.

Developer ToolsRelated tool: JSON Formatter and Validator

Quick answer

JSON (JavaScript Object Notation) represents data as text using objects `{ "key": value }` and arrays `[ ... ]`. It is widely used for APIs, config files, and data exchange because it is human-readable and easy to parse in every major programming language.

Use the tool

Convert or calculate with our free json formatter and validator.

Overview

JSON is the lingua franca of modern APIs and configuration systems. Before converting JSON to CSV, validating a webhook payload, or debugging a REST response, it helps to recognize valid structure, common nesting patterns, and the strict syntax rules parsers enforce. This guide covers core syntax, the data shapes you will encounter in production, and how JSON fits into API-driven workflows from request to spreadsheet export. Whether you are a developer piping webhook data into operations or an analyst receiving API exports from engineering, the same structural literacy prevents broken imports and silent data loss at the format boundary.

Core JSON syntax

JSON objects wrap key-value pairs in curly braces. Keys must be double-quoted strings; values can be strings, numbers, booleans (true or false), null, arrays, or nested objects. Arrays list values in square brackets with comma separators. Strings use double quotes exclusively—single quotes are invalid.

JSON does not allow comments, trailing commas, undefined values, or unquoted object keys. Functions, dates, and undefined from JavaScript do not serialize to JSON without explicit conversion. Strict parsers reject any deviation, which is why pasted JavaScript object literals often fail validation until you remove trailing commas and swap quotes. Validators that pretty-print also minify—both operations require parseable input.

Supported data types and encoding

Numbers include integers and floats; scientific notation is allowed. Strings support Unicode and standard escape sequences (\n, \t, \", \\). Boolean true and false are lowercase literals. null represents an intentional absence of value, distinct from an empty string or zero.

There is no native date type—APIs typically use ISO 8601 strings like "2026-05-23T14:30:00Z". Binary data appears as Base64-encoded strings inside JSON rather than raw bytes. When exporting to CSV, remember that JSON types do not map perfectly: booleans become TRUE/FALSE text and null becomes an empty cell unless your converter specifies otherwise.

Shapes you will see in the wild

An array of uniform objects—[{ "id": 1, "name": "Ada" }, { "id": 2, "name": "Ben" }]—maps cleanly to spreadsheet rows where each object becomes one row and each key becomes a column. This is the easiest JSON shape for CSV conversion and Excel import.

A single nested document—{ "company": { "name": "Acme", "offices": [...] } }—requires flattening before most tabular tools can consume it. Pagination wrappers like { "data": [...], "meta": { "page": 1 } } are common in REST APIs; extract the inner array before converting. Null fields, empty arrays, and missing keys create sparse CSV output if not handled explicitly.

JSON in API request and response workflows

REST APIs send JSON in HTTP bodies with Content-Type: application/json. Clients POST JSON payloads to create resources and GET JSON responses to read them. GraphQL returns JSON with a data envelope and optional errors array. Webhooks deliver event JSON to your endpoint; validating structure before processing prevents silent data corruption.

Typical workflow: fetch an API endpoint, receive a JSON array of records, pretty-print or validate with a formatter, optionally flatten nested fields, then convert to CSV for finance or operations teams in Excel. Config files (package.json, tsconfig.json, CI pipelines) use the same syntax, so the skills transfer between runtime API data and developer tooling. Log sample payloads in staging—not production—to debug schema drift without exposing customer PII.

Validation, minification, and readability

Minified JSON removes whitespace for wire transfer; formatted (pretty-printed) JSON adds indentation for human review. Both are semantically identical if the underlying structure matches. Online formatters detect syntax errors with line-level feedback, which saves time when debugging large webhook payloads.

Schema validation (JSON Schema, OpenAPI models, or language-native types) enforces required fields and data types at build time or runtime. Even without formal schemas, checking for expected top-level keys—data, results, items—before conversion prevents empty CSV exports when an API changes its envelope structure.

Security and safe handling

Never eval() JSON or treat parsed JSON as executable code. JSON is data, not a scripting language—though historically some libraries confused the two. When pasting JSON from email or tickets into online tools, remember it may contain personal data subject to privacy policies; client-side formatters that do not upload payloads reduce exposure compared to cloud validators that store inputs.

Large JSON files can exhaust browser memory when pretty-printed. Stream or chunk multi-gigabyte exports on the server side rather than in a tab. For public APIs, rate-limit and authenticate endpoints that return sensitive JSON rather than relying on obscurity of field names. Redact tokens before sharing formatted samples in support tickets.

Examples

  • API user list to spreadsheet

    [{"id":1,"email":"a@example.com","active":true},{"id":2,"email":"b@example.com","active":false}] becomes two CSV rows with columns id, email, and active—ready for Excel filtering and pivot tables. Import the CSV with the email column as text if addresses are primary keys for a mail-merge workflow.

  • Nested config snippet

    { "database": { "host": "localhost", "port": 5432 }, "features": ["auth", "billing"] } illustrates mixed objects and arrays. Flattening produces columns like database.host and a stringified features column unless arrays are expanded separately. DevOps teams often keep configs as JSON and only flatten for audit spreadsheets.

  • Paginated API response

    { "data": [{ "orderId": "A100" }], "meta": { "total": 847, "page": 1 } } requires extracting the data array before CSV conversion; meta belongs in a separate report row or summary sheet, not mixed with order rows. Loop pagination in code until meta.page exceeds meta.totalPages, then concatenate arrays before a single CSV export.

Common mistakes and edge cases

  • Using single quotes for strings and keys—JSON requires double quotes throughout.
  • Expecting CSV-style flat rows when the payload is one deeply nested object without flattening.
  • Pasting JavaScript object literals with trailing commas, comments, or unquoted keys into a strict JSON parser.
  • Treating undefined or NaN from JavaScript as JSON—they are not valid JSON values and must be converted or omitted.
  • Assuming API field order is guaranteed—unlike CSV, JSON object key order is not semantically meaningful and may change between responses.
  • Storing secrets or API keys inside JSON config files committed to git—use environment variables and secret managers instead.

Related resources

Related tools

Last reviewed: 2026-05-23