If you have ever called an API, configured an application, or looked at a browser's network tab, you have already seen JSON. It sits between almost every frontend and backend today, and despite looking simple, it causes a surprising number of bugs.
I have lost count of how many times a malformed JSON response broke an integration, or how often someone confused a JSON string with a JavaScript object. This guide covers what JSON actually is, where it trips people up, and how to work with it without pulling your hair out.
What JSON Looks Like in the Real World
JSON is plain text that represents data using key-value pairs. A typical API response looks like this:
{
"status": "success",
"data": {
"userId": 123,
"username": "developer",
"email": "dev@example.com",
"isActive": true
},
"timestamp": "2024-01-15T10:30:00Z"
}
No fancy binary format, no angle brackets like XML, just readable text. That readability is why it won over so many developers. Machines can parse it, humans can debug it, and every modern language has built-in support for it.
The Six Value Types You Need to Know
JSON only supports these six types. Everything you see falls into one of them:
- String: text in double quotes, like
"hello" - Number: integers or floats, like
42or3.14 - Boolean:
trueorfalse - Array: an ordered list, like
["a", "b", "c"] - Object: nested key-value pairs, like
{"name": "Frank"} - Null: the empty value
null
The most common mistake I see is treating a string that contains a number as an actual number. "42" is not 42. Your frontend might display it correctly, but your sorting, math, and database comparisons will behave unexpectedly.
Where JSON Actually Gets Used
API Responses and Requests
REST APIs almost always speak JSON. When your frontend fetches user data, it expects something like this:
{
"id": 1,
"name": "Frank",
"roles": ["admin", "developer"]
}
If the backend accidentally returns a single value instead of an object, or forgets to quote a key, your JSON.parse() call throws and your app crashes. We have a whole guide on fixing the most common JSON parse error if you have hit that wall.
Configuration Files
Package managers, build tools, and cloud platforms love JSON for configuration:
{
"name": "my-app",
"version": "1.0.0",
"scripts": {
"start": "node server.js",
"test": "jest"
}
}
The downside? One trailing comma and the entire file is invalid. That is why I always run config files through a formatter before committing.
Data Storage and Logs
Many databases and logging systems store JSON or JSON-like documents. MongoDB stores BSON, PostgreSQL has a jsonb column type, and cloud log platforms often return query results as JSON. Knowing how to read and shape JSON is not optional for modern backend work.
Common Mistakes That Waste Hours
Single Quotes Instead of Double Quotes
JSON is picky. Keys and strings must use double quotes.
// This is a JavaScript object, not JSON
{ name: 'Frank' }
// This is valid JSON
{ "name": "Frank" }
If you copy a JavaScript object into a JSON parser, it will fail. Always validate.
Trailing Commas
JavaScript tolerates trailing commas. JSON does not.
{
"name": "Frank",
"role": "developer",
}
That last comma makes this invalid. Remove it, or use a formatter that flags the issue automatically.
Confusing JSON with JavaScript Objects
JSON is a string format. A JavaScript object is an in-memory data structure. They look similar, but they are not the same. You cannot store functions, undefined, or comments in JSON. If you need comments, use a separate documentation file or switch to JSON5.
Practical JSON Workflow
When I work with JSON, my usual flow is:
- Paste the raw JSON into a formatter to see the structure
- Validate it to catch syntax errors early
- Compress it only when I need to send it over the wire
Our JSON Formatter handles all three steps in the browser. Nothing gets uploaded to a server, so you can safely paste production payloads.
Questions I Get Asked About JSON
Can JSON contain comments?
No. Standard JSON does not support comments. Some tools accept JSON5 or JSON with comments, but if you are communicating with a standard parser, keep comments out.
How do I handle Unicode in JSON?
JSON supports full Unicode. Save your files as UTF-8 and you can include most characters directly. Escaping is only needed for control characters and quotes.
What is the biggest JSON gotcha?
In my experience, the number one issue is assuming the structure you receive matches the structure you expect. Always validate JSON against a schema or at least check that required fields exist before using them.
Conclusion
JSON is everywhere because it is simple, readable, and portable. But simple does not mean foolproof. Unit confusion, trailing commas, and missing validation still waste developer time every day.
Use the FastUnix JSON Formatter when you need to validate or beautify a payload. If you are working with timestamps inside JSON APIs, the Unix Timestamp Converter will save you from the seconds-vs-milliseconds trap I mentioned earlier.