JSON: The Lingua Franca of Modern Software
By The IT Hustle Team
This article was generated with AI assistance and reviewed by our team for accuracy and quality. All technical information and examples have been verified.
If you've ever opened a web page, used a mobile app, called an API, or edited a config file, you've interacted with JSON. You may not have known it, but it was there — quietly shuttling data between systems, keeping the modern internet running.
JSON (JavaScript Object Notation) is the universal language of data exchange in modern software. APIs speak JSON. Configuration files use JSON. Databases store JSON. Log files output JSON. If data moves between two systems in 2026, there's a very good chance it moves as JSON.
This article is for anyone who works near technology — developers, analysts, project managers, operations teams — and wants to understand what JSON is, why it won, and how to work with it without making the mistakes that cost everyone time.
What Is JSON?
JSON is a lightweight text format for storing and transmitting structured data. It was derived from JavaScript but is completely language-independent — every major programming language can read and write JSON.
Here's the simplest possible JSON:
{
"name": "Alice",
"age": 32,
"isActive": true
}
That's it. Curly braces hold objects (key-value pairs). Keys are always strings in double quotes. Values can be strings, numbers, booleans (true/false), null, arrays, or other objects. That's the entire specification. You can learn the complete JSON syntax in five minutes.
Why JSON Won (and XML Lost)
Before JSON, the dominant data exchange format was XML. If you've never had to work with XML, consider yourself fortunate. Here's the same data in both formats:
{"name":"Alice","age":32,"active":true}
<user>
<name>Alice</name>
<age>32</age>
<active>true</active>
</user>
JSON won for several reasons:
- It's smaller. Less bandwidth, faster transfers, cheaper storage. At scale, this matters enormously. An API returning millions of records per day saves significant bandwidth with JSON over XML.
- It's easier to read. Humans can scan JSON and understand the structure immediately. XML requires mentally filtering out closing tags and attributes.
- It maps directly to programming constructs. JSON objects are dictionaries/maps. JSON arrays are lists/arrays. Every language already has these data structures built in, so parsing JSON is trivial.
- It's natively JavaScript. Since the web runs on JavaScript, JSON can be parsed with a single function call:
JSON.parse(). No external libraries needed. - It has no schema overhead. XML often requires DTDs or XSD schemas. JSON is self-describing — you can figure out the structure just by looking at it.
The Anatomy of JSON: Every Data Type Explained
JSON has exactly six data types. That's it — no dates, no binary, no comments. This extreme simplicity is a feature, not a bug.
1. Strings
Text wrapped in double quotes only. Single quotes are not valid JSON (this is the #1 mistake people make).
"Hello, world" ✅ valid
'Hello, world' ❌ invalid (single quotes)
2. Numbers
Integers or floating-point. No quotes. No special notation for integers vs floats.
42 ✅ integer
3.14 ✅ float
-17 ✅ negative
0x1A ❌ invalid (no hex in JSON)
3. Booleans
true or false — lowercase, no quotes.
true ✅ valid
True ❌ invalid (capital T)
"true" ⚠️ valid but it's a string, not a boolean
4. Null
Represents "no value." Lowercase, no quotes.
null ✅ valid
None ❌ invalid (that's Python)
undefined ❌ invalid (that's JavaScript)
5. Arrays
Ordered lists wrapped in square brackets. Items can be any type, including other arrays or objects.
[1, 2, 3] ✅ array of numbers
["red", "green", "blue"] ✅ array of strings
[1, "two", true, null, [5, 6]] ✅ mixed types (valid but unusual)
6. Objects
Key-value pairs wrapped in curly braces. Keys must be strings. Values can be any type.
{
"user": {
"name": "Alice",
"roles": ["admin", "editor"],
"settings": {
"theme": "dark",
"notifications": true
}
}
}
Nesting objects inside objects is what makes JSON powerful. You can represent arbitrarily complex data structures with just these six types.
Where You'll Encounter JSON in the Real World
REST APIs
The vast majority of web APIs send and receive JSON. When your app fetches data from a server, here's what comes back:
{
"id": 123,
"name": "Alice Chen",
"email": "alice@example.com",
"plan": "premium",
"created_at": "2026-01-15T10:30:00Z"
}
Configuration Files
package.json, tsconfig.json, .eslintrc.json, VS Code settings — JSON is the default format for configuration in the JavaScript/Node ecosystem.
{
"name": "my-app",
"version": "1.0.0",
"scripts": {
"start": "next start",
"build": "next build",
"test": "jest"
},
"dependencies": {
"next": "^14.0.0",
"react": "^18.0.0"
}
}
Database Storage
Modern databases like PostgreSQL and MongoDB store JSON natively. PostgreSQL's jsonb column type lets you query inside JSON documents with SQL — combining the flexibility of document databases with the reliability of relational databases.
Structured Logging
Modern logging systems output JSON instead of plain text. This makes logs machine-parseable while still being human-readable:
2026-03-15 10:30:15 ERROR [auth] Login failed for user alice@example.com from 192.168.1.1
{"timestamp":"2026-03-15T10:30:15Z","level":"error",
"service":"auth","message":"Login failed","user":"alice@example.com","ip":"192.168.1.1"}
The 7 Most Common JSON Mistakes
These are the errors I see most often, ranked by frequency. Every developer makes at least one of these regularly.
1. Trailing Commas
JavaScript allows trailing commas. JSON does not. This is the most common JSON syntax error.
❌ {"name": "Alice", "age": 32,} ← trailing comma after 32
✅ {"name": "Alice", "age": 32} ← no trailing comma
2. Single Quotes
JSON requires double quotes for strings. Single quotes are invalid.
❌ {'name': 'Alice'} ← single quotes
✅ {"name": "Alice"} ← double quotes
3. Comments
JSON does not support comments. No //, no /* */, nothing. This is by design — Douglas Crockford (JSON's creator) intentionally excluded comments to prevent people from using JSON as a scripting language.
❌ { // this is a user "name": "Alice" }
✅ { "_comment": "this is a user", "name": "Alice" }
If you need comments in configuration files, consider JSONC (JSON with comments, used by VS Code) or YAML instead.
4. Unquoted Keys
❌ {name: "Alice"} ← unquoted key
✅ {"name": "Alice"} ← quoted key
5. Using undefined
❌ {"value": undefined} ← undefined is JavaScript, not JSON
✅ {"value": null} ← use null instead
6. Newlines in Strings
JSON strings cannot contain literal newlines. Use \n instead.
❌ {"bio": "Line one
Line two"}
✅ {"bio": "Line one\nLine two"}
7. Number Precision
JSON numbers are IEEE 754 floating-point. This means integers larger than 2^53 (9,007,199,254,740,992) lose precision when parsed in JavaScript. If you're working with IDs from databases like Snowflake or Twitter, send them as strings.
⚠️ {"id": 9007199254740993} ← will be parsed as 9007199254740992
✅ {"id": "9007199254740993"} ← string preserves precision
Working with JSON: Essential Operations
Parsing JSON (String to Object)
const data = JSON.parse('{"name":"Alice"}');
console.log(data.name); // "Alice"
import json
data = json.loads('{"name":"Alice"}')
print(data["name"]) # "Alice"
Always wrap JSON.parse() in a try/catch. If the JSON is malformed, it throws an error that will crash your application if unhandled.
Stringifying JSON (Object to String)
JSON.stringify(data); // {"name":"Alice","age":32}
JSON.stringify(data, null, 2); // indented with 2 spaces
The third argument to JSON.stringify() controls indentation. Use 2 for readability. Use no arguments (or 0) for minimum file size.
Command-Line JSON with jq
If you work with APIs from the command line, jq is the essential tool for parsing and manipulating JSON:
curl -s https://api.example.com/users | jq '.'
curl -s https://api.example.com/users | jq '.[].name'
curl -s https://api.example.com/users | jq '[.[] | select(.active == true)]'
JSON Variants You Should Know About
- JSONC — JSON with comments. Used by VS Code, TypeScript (tsconfig.json). Allows // and /* */ comments.
- JSON5 — A superset of JSON that allows trailing commas, single quotes, comments, unquoted keys, and hex numbers. More human-friendly for config files.
- NDJSON — Newline-delimited JSON. One JSON object per line, used for streaming and log files. Each line is independently parseable.
- JSON Schema — A vocabulary for annotating and validating JSON. Lets you define required fields, data types, value ranges, and patterns. Essential for API contracts.
Key Takeaways
- JSON has 6 types: string, number, boolean, null, array, object. That's the entire language.
- Double quotes only. No single quotes, no unquoted keys, no trailing commas, no comments.
- JSON is everywhere: APIs, config files, databases, logs. Understanding it is non-negotiable if you work in tech.
- Always validate JSON before using it. A missing comma or extra bracket will silently break your application.
- Use tools to help. Pretty-printers, validators, and formatters save time and prevent errors.
Working with messy JSON? Try our free JSON Formatter — paste any JSON and instantly get it validated, pretty-printed, and syntax-highlighted with error detection. No signup required.
We build free developer tools and write about AI, automation, and developer productivity. 30 tools, 33 articles, and an AI Prompt Engine — all built to help workers navigate the AI era. Published by Salty Rantz LLC.
The IT Hustle Weekly
What changed in AI this week and what it means for your job. Free tools, honest reviews, zero spam.
Generate Your Own Anti-Hallucination Prompts
Our AI Prompt Engine uses patent-pending technology to generate prompts with built-in verification and contradiction testing.
Try 3 Free Generations →