JSON explained: the data format that runs the modern internet

JSON explained: the data format that runs the modern internet — Informatics Hub
Code on dark screen with structured data format
Tech Guides

JSON explained: the data format that runs the modern internet

Informatics Hub20266 min read

If APIs are the roads of the internet, JSON is the vehicles driving on them. Every time two apps exchange data — a weather service, a payment processor, an AI model — they almost certainly do it in JSON. Here's everything you need to know.

JSON stands for JavaScript Object Notation. Despite the JavaScript in the name, it's language-agnostic — Python, Java, Go, Ruby, and every other major language can read and write it. It became the universal format for data exchange because it's lightweight, human-readable, and dead simple to parse programmatically.

JSON is just structured text. There's no magic to it. Once you see the pattern, you can read any JSON response from any API in the world without a second thought.
Terminal showing structured API response data

Every API response you'll ever work with looks roughly like this — once you know JSON, you can read all of them

What JSON looks like

Here's a real example of what an API might return when you request a user's profile:

{
  "id": 4821,
  "name": "Mohamed",
  "email": "m@example.com",
  "is_active": true,
  "skills": ["Python", "AI", "Automation"],
  "address": {
    "city": "Jeddah",
    "country": "Saudi Arabia"
  }
}

The building blocks

JSON has exactly six data types — that's the entire specification:

  • String — text wrapped in double quotes: "hello"
  • Number — integers or decimals, no quotes: 42 or 3.14
  • Boolean — true or false, lowercase, no quotes: true
  • Array — a list of values in square brackets: ["a", "b", "c"]
  • Object — key-value pairs in curly braces: {"key": "value"}
  • Null — represents nothing: null

Reading JSON in Python

# Python's built-in json library handles everything
import json

# Parse a JSON string into a Python dictionary
data = json.loads('{"name": "Mohamed", "age": 21}')
print(data["name"]) # Output: Mohamed

# Convert a Python dictionary to JSON string
json_string = json.dumps(data)

# API responses come as JSON — access them like a dictionary
response = requests.get(url)
data = response.json() # Parses automatically

Where JSON shows up

  • Every REST API response — weather, payments, social media, AI models
  • Configuration files for tools like VS Code, Docker, and npm
  • Data storage in NoSQL databases like MongoDB and Firebase
  • Communication between microservices in backend systems
  • Webhook payloads from Stripe, GitHub, Slack, and every other platform
One thing to watch out for

JSON keys must be strings in double quotes. Trailing commas after the last item in an object or array will cause a parse error. These are the two mistakes that trip up almost every beginner when writing JSON manually. When in doubt, use a JSON validator — JSONLint.com is free and instant.

Key takeaways

  • JSON is the universal data exchange format — every API uses it
  • It has only six data types: string, number, boolean, array, object, null
  • Python's built-in json library handles parsing and generation natively
  • Once you can read JSON, you can work with any API in the world

Comments