toolrota

What is JSON? Structure of the data format, where it's used and common mistakes

Apps mostly talk to each other in JSON. We explain JSON's structure, where it's used and the common syntax mistakes.

Serkan Akyürek··3 min read
What is JSON? Structure of the data format, where it's used and common mistakes – SaaS & Cloud

When a weather app pulls data from a server or a website sends information to a payment system, the data usually travels in JSON (JavaScript Object Notation). JSON is a plain text format that people can read and computers can process easily. Despite the JavaScript in its name, almost every programming language supports it.

Basic structure

A JSON object starts with a curly brace and consists of key-value pairs. Keys are always written in double quotes. For example, a product could have the value "Pen" for the key "name", 25 for "price", true for "inStock" and the array ["blue", "black"] for "colors".

Data typeExampleNote
String"Pen"Double quotes required
Number25 or 12.5Written without quotes
Booleantrue or falseLowercase
NullnullMeaning no value
Array["blue", "black"]Square brackets
ObjectNested curly bracesHierarchical data

Where is it used?

  • APIs: data exchange between apps; see our API guide.
  • Webhook notifications: event details arrive as JSON; see our webhook guide.
  • Config files: many apps and tools keep settings in JSON files.
  • NoSQL databases: document databases use a JSON-like structure; see our NoSQL guide.
  • Data exports: when downloading your data from services.
Reading a JSON file
  1. 1

    Check whether the outermost bracket is an object or an array

  2. 2

    Read the keys in order

  3. 3

    Follow nested objects by indentation

  4. 4

    Note how many items the arrays hold

  5. 5

    Format it with a validator if needed

JSON, XML and CSV compared

FeatureJSONXMLCSV
ReadabilityHighMediumHigh (tables)
Nested dataSupportedSupportedNot supported
SizeSmallLargerSmallest
Typical useAPIs and settingsDocuments, older systemsTables, Excel

You can bring JSON data into Excel with Power Query; see our Power Query intro guide.

Common mistakes

  1. Leaving a comma after the last item. JSON doesn't allow trailing commas.
  2. Using single quotes. Strings and keys need double quotes.
  3. Adding comments. Standard JSON doesn't support comments.
  4. Writing True instead of true. Booleans are lowercase.
  5. Leaving passwords and keys exposed in JSON config files.

Frequently asked questions

Is JSON a programming language? No, it's just a data format.

How do I find broken JSON? Online or code editor validators show the line of the error; don't paste files with sensitive data into unknown sites.

Summary

JSON is the common language of modern software. Once you know objects, arrays and data types, you can read API responses and config files with ease.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.