In this article
JSON in two minutes
JSON (JavaScript Object Notation) is a text format for structured data. It has only a few building blocks:
| Part | Looks like | Meaning |
|---|---|---|
| Object | { "name": "Ali", "age": 30 } | A set of named values |
| Array | [ "red", "green" ] | An ordered list |
| String | "hello" | Text, always in double quotes |
| Number | 42, 3.14 | No quotes |
| Boolean | true, false | Yes / no |
| Null | null | Nothing / unknown |
Objects and arrays can be nested inside each other as deeply as needed – an order contains a customer object and an array of items, each item an object with a name and price.
Why raw API responses are hard to read
To save space, APIs usually send JSON on one long line with no spaces. A response of a few kilobytes becomes an unreadable wall of brackets. Formatting adds line breaks and indentation so each level of nesting is visible at a glance.
How to format JSON
- Paste the JSON into the JSON Formatter.
- Choose 2 spaces, 4 spaces or tabs.
- Optionally sort keys A–Z – helpful when comparing two responses.
- Copy the formatted result. If the JSON is broken, you see the line and column of the problem.
Reading a response step by step
Take a typical weather API answer. After formatting you will see something like a top-level object with keys such as "location", "current" and "forecast". Read top-down: first the keys at the outer level, then open each one. A path such as forecast.days[0].maxTemp means “inside forecast, in the days array, the first item’s maxTemp”. Arrays start counting at 0.
Common things you will spot
- Error objects: many APIs return
{"error": {"code": 401, "message": "Invalid API key"}}– the message usually tells you exactly what is wrong. - Timestamps: numbers like
1767225600are Unix time. Convert them with the Timestamp Converter. - Encoded data: long strings of letters ending in “=” are often Base64. Decode with the Base64 Decoder.
- Pagination: keys like
next,pageorcursormean there is more data to fetch.
Sorting keys to compare responses
Two responses can contain the same data in a different key order, which makes them look different line by line. Sort keys in both, then paste them into Text Compare – now only real differences are highlighted.
JSON is not always friendly in spreadsheets
If you need the data in Excel or Google Sheets, convert an array of objects to CSV with the CSV ⇄ JSON Converter. Nested objects become dotted column names like customer.city.
Keep secrets private
API responses often contain tokens, personal data and internal IDs. Pasting them into random online formatters can leak them. ConvertNest formats JSON entirely in your browser – nothing is sent to a server.