18/11/2026 10:05am

What Is JSON? A Beginner's Guide to Reading JSON Files and Data
#what is json
#json file
#json format
#is json a programming language
#json pronunciation
#json object array
#json syntax errors
Picture this: you have just typed https://api.github.com/users/octocat into your browser, following along with our API walkthrough, and the page fills up with curly braces, quotation marks, colons and commas. It looks like code, but not like any code you have written. A lot of beginners stop right there, assuming they need to learn yet another language before any of it makes sense.
They do not. What you are looking at is JSON, and its entire rulebook is short enough to cover in one article. Today Superdev Academy will read a real GitHub response with you, line by line: Objects, Arrays, key/value pairs, and the handful of mistakes that break JSON files more often than anything else.
JSON is a text data format, not a programming language
JSON stands for JavaScript Object Notation. It is a way of writing data as plain text so that programs written in different languages can pass that data to each other. The ECMA-404 standard describes JSON as a text syntax that makes structured data interchange possible between all programming languages. The IETF's RFC 8259 registers its file extension as .json and its media type as application/json.
Put simply, a JSON file is a text file you can open in Notepad. It holds data and nothing else: no if statements, no loops, no functions. That is why JSON is not a programming language. It cannot run on its own; a program written in JavaScript, Python, Go or anything else has to read it.
Fun Fact: the 2017 edition of ECMA-404 includes a footnote saying JSON is pronounced like the name "Jason", as in Jason and The Argonauts.
Reading real JSON: GitHub's answer
Here is what the GitHub REST API sends back when you ask for the octocat account. We have trimmed it to a few fields. Some values, such as public_repos, may differ on the day you try it (we fetched this on 29 September 2026), but the structure stays the same.
{
"login": "octocat",
"id": 583231,
"name": "The Octocat",
"site_admin": false,
"email": null,
"public_repos": 8
}Four rules are enough to read it:
The whole thing is wrapped in curly braces { }. That is an Object: a box that holds several named fields together.
Each field is a key/value pair separated by a colon. "login": "octocat" means the field called login holds the value octocat.
Keys always sit inside double quotes (").
Pairs are separated by commas, and the last pair has no comma after it.
That is all it takes to read the response above: the account is named The Octocat, its id is 583231, it is not a GitHub site administrator, and it does not show a public email address.
JSON values come in exactly 6 types
RFC 8259 says JSON can represent four primitive types and two structured types, six in total. Every one of them already appears in GitHub's responses.
String: text inside double quotes, such as "The Octocat"
Number: digits with no quotes, such as 583231
Boolean: only true or false, such as "site_admin": false
null: no value at all, such as "email": null
Object: a { } box of key/value pairs
Array: an ordered list inside square brackets [ ], such as "topics": []
A common beginner slip: "583231" and 583231 are not the same thing. The first is text that happens to contain digits; the second is a real number you can do arithmetic with. RFC 8259 also requires true, false and null to be lowercase. Write True or NULL and the file stops being valid JSON.
Objects and Arrays nest, like boxes inside boxes
Real data is rarely one level deep. Ask for octocat's repositories at https://api.github.com/users/octocat/repos and the response starts with [ because it is an Array of repositories. Here is one of them, trimmed to a few fields:
[
{
"name": "Spoon-Knife",
"private": false,
"owner": {
"login": "octocat",
"type": "User"
},
"language": "HTML",
"topics": []
}
]Read it from the outside in. The outer layer is an Array. Inside it is an Object for the repository called Spoon-Knife. Inside that, owner is another Object, which tells you the owner is octocat. And topics is an empty Array, meaning no topics have been added to this repository.
To get the owner's name, walk the path: take the first item in the Array, open owner, then read login. In JavaScript that is data[0].owner.login, which gives you "octocat". Nested JSON is not harder to read. You just open one box at a time.
The 3 mistakes that break JSON most often
JSON is stricter than it looks. One character too many or too few and the program rejects the whole file. We fed each of these three mistakes into JSON.parse() on Node.js v26, and these are the errors it returned. Browsers and other languages word their errors differently, but they mean the same thing.
1. A trailing comma
{"login": "octocat",}
SyntaxError: Expected double-quoted property name in JSON at position 20 (line 1 column 21)The parser sees the comma, waits for another key, and finds a closing brace instead.
2. Single quotes
{'login': 'octocat'}
SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)JavaScript accepts ' for strings. JSON only accepts ", for keys and string values alike.
3. A comment
{"login": "octocat" // sample account
}
SyntaxError: Expected ',' or '}' after property value in JSON at position 20 (line 1 column 21)As MDN notes, JSON has no support for comments at all, whether // or /* */.
One habit helps a lot: read the position number in the error. It points to the character where the parser gave up, counting from 0. Look at that spot and the character just before it, and you will usually find the culprit within a few characters.
But VS Code's settings.json has comments in it
True. If you have ever opened VS Code's settings file, you have probably seen // lines inside it. The VS Code documentation explains that files such as settings.json, tasks.json and launch.json use a JSON with Comments (jsonc) mode, which accepts comments and also accepts trailing commas, though it shows a warning for those.
That is an extension one program chooses to accept. RFC 8259 allows a parser to accept non-JSON forms if it wants to, which is not the same as every program doing so. Node.js's package.json sits on the other side: npm's documentation states plainly that it must be actual JSON, not just a JavaScript object literal.
So the safe rule is this: anything another program will read, and anything you send through an API, should be strict, standard JSON. Do not assume that because it loads on your machine, it will load at the other end.
What is JSON used for? 4 places you will meet it
Once you know what it looks like, you will notice it almost everywhere in programming work.
API responses: a great many web APIs send their data back as JSON, just like GitHub did. If you have not called one yourself yet, start with What Is an API? How APIs Work, with a Real Example for Beginners.
package.json: every Node.js project has one, listing the project's name, version and the libraries it uses. When you publish a package, name and version are the fields that matter most.
Settings files: many programs store their configuration as .json files, including code editors such as VS Code.
AI responses: when you want an AI model to return data a program can use directly, you often ask it to answer in JSON, which we covered in Golang The Series EP.147: Structured Output.
Next step: let the program do the reading
JavaScript ships with two built-in tools for this. JSON.parse() turns JSON text into data your program can use. JSON.stringify() goes the other way, turning data in your program into JSON text you can send or save to a file.
JSON.stringify({ login: "octocat", public_repos: 8 })
// gives the text {"login":"octocat","public_repos":8}Notice that JSON.stringify() adds the double quotes around every key for you. That is why JSON generated by a program almost never hits the three mistakes above; JSON usually breaks when a person types it by hand. If you want to see how another language handles JSON differently from JavaScript, JS2GO EP.22 Working with JSON compares it with Go in detail.
Summary: what a JSON file is and how to read it
JSON is a text file that stores data under a small set of rules. It is not a programming language. Data lives as key/value pairs inside Objects { } or as ordered lists inside Arrays [ ], and values come in just six types: String, Number, true/false, null, Object and Array. The things that break JSON most often are a trailing comma, single quotes and comments.
The fastest way to get fluent is to read real JSON often. Open https://api.github.com/users/octocat/repos and find each repository's language by eye first. Then type a short piece of JSON yourself, pass it to JSON.parse(), and when it throws an error, read the position it gives you. You will learn more that way than by memorising the rules.
Follow more articles and tips for people starting out as programmers on our channels.
Facebook: Superdev Academy Thailand (https://www.facebook.com/superdev.academy.th)
YouTube: Superdev Academy Channel (https://www.youtube.com/@SuperdevAcademy)
Instagram: @superdevacademy (https://www.instagram.com/superdevacademy/)
TikTok: @superdevacademy (https://www.tiktok.com/@superdevacademy?lang=th-TH)
FAQ: Frequently Asked Questions about This Article
A collection of questions and answers to help you better understand the content of this article.