JSON guides

The background behind our JSON formatter. Syntax, the mistakes that break parsers, how JSON compares with other formats, and how to validate the shape of a document.

7 articles, newest first

  • · 4 min read

    JSON Schema: How to Validate the Shape of Your JSON

    An introduction to JSON Schema with a complete example. Learn type, required, properties, enum, pattern and $ref, and how to run validation in JavaScript and Python.

    json schema validation

  • · 3 min read

    How to Pretty Print JSON from the Command Line

    Format and query JSON in the terminal with jq, Python, Node and PowerShell. One liners for files, curl output and clipboard contents on macOS, Linux and Windows.

    jq command line python

  • · 3 min read

    JSON.stringify and JSON.parse Explained, Including the Surprises

    How JavaScript converts between objects and JSON text, with the replacer, reviver and indent arguments, and the cases that silently lose data.

    javascript json.parse json.stringify

  • · 3 min read

    JSON vs YAML for Configuration Files

    YAML is easier to write and JSON is harder to get wrong. See the real differences, the famous YAML gotchas, and which format to pick for your config.

    yaml config files comparison

  • · 3 min read

    JSON vs XML: Which Data Format Should You Use?

    A practical comparison of JSON and XML covering size, readability, schemas, tooling and the cases where XML is still the right answer.

    xml data formats comparison

  • · 4 min read

    Fix 10 JSON Syntax Errors That Break Your API Responses

    JSON syntax rules and ten errors you can diagnose, with broken and fixed examples for commas, quotes, escapes, literals and duplicate keys.

    json syntax errors debugging

  • · 4 min read

    What Is JSON? A Beginner's Guide with Examples

    JSON explained from scratch: what it looks like, the six value types, where it is used, and how it compares to a JavaScript object.

    basics json syntax

Choose a guide for your task

When JSON is unfamiliar, start with the value types and a complete document in the introduction. It separates JSON text from a JavaScript object and shows why a parser needs quoted names, specific literals and balanced delimiters. Keep that distinction in mind when copying an object from source code into an API request. Code accepted by JavaScript is not automatically valid JSON.

For an input that fails to parse, open the syntax errors guide. Compare its broken and fixed examples with the formatter's error message and any available location. A reported location can be later than the character you need to change. Repair the original text before formatting it and check warnings about duplicate names or numeric precision rather than assuming readable output preserved every value.

If parsing succeeds but your application behaves unexpectedly, read the stringify and parse guide. It covers dates, missing values, conversion hooks and the limits of a text round trip. Use the JSON Schema article when you need a required field, a type or a range checked before business logic runs. A schema can check those constraints, but it cannot prove that an address belongs to a customer or that an amount is correct.

The format comparisons help when you can choose between JSON, YAML and XML. Decide from the data shape, editing workflow and receiving system, then compare the actual files you plan to use. For scripts and shell pipelines, use the command line guide. For a nested response you need to understand, format it first and open the visualizer to inspect its structure. The diagram has a node limit, so check its truncation notice and return to the source text when you need a field that is not displayed.

← All articles

↑ Top