JSON is a text format that stores data in a way computers can read and humans can understand
JSON stands for JavaScript Object Notation. It is a way of writing information — names, numbers, lists, true-or-false values — in plain text so that both people and programs can read it. You will not usually create a JSON file yourself, but you may encounter one when downloading data from a website, configuring a program, or storing settings.
A JSON file is just a text file with a .json extension. Inside it, data is organized using curly braces { }, square brackets [ ], and colons. The format is strict about punctuation, but once you understand the pattern, you can read what is inside without special software — any text editor will open it.
JSON became popular because it is simpler than older formats like XML, and because it works the same way across different programming languages. A program written in Python can read a JSON file created by a program written in Java. This makes it useful for sharing data between different systems.
Key Takeaways
- JSON files store data in plain text using a simple structure of braces, brackets, and colons that both humans and computers can read.
- You can open a JSON file with any text editor like Notepad, TextEdit, or VS Code without needing special software.
- Common uses include storing website settings, exporting data from online services, and letting different programs share information with each other.
- The format is strict about punctuation — a missing comma or bracket will break the file — but the rules are consistent and learnable.
How JSON organizes information
JSON uses two main structures: objects and arrays. An object holds pairs of names and values inside curly braces. For example:
{ "name": "Sarah", "age": 28, "city": "Portland" }
Each piece of information has a label (the name in quotes) and a value (what comes after the colon). The label tells you what the value means.
An array is a list of items inside square brackets. Arrays hold multiple values in order:
{ "name": "Sarah", "hobbies": ["reading", "hiking", "cooking"] }
You can nest objects and arrays inside each other, creating more complex structures. A JSON file can hold a single object, a single array, or an array of objects. The format stays consistent no matter how deep you go.
Where you will encounter JSON files
When you download your data from a website — your photos from Google Photos, your messages from a messaging app, or your financial records from a bank — the file often comes as JSON. This is because JSON is a neutral format that does not depend on any one company or program.
Configuration files for programs often use JSON. If you set up a tool like VS Code or a build system, you may edit a JSON file to change how it behaves. Game mods and browser extensions also use JSON to store settings.
APIs — the systems that let programs talk to each other — almost always send data back as JSON. When a weather app on your phone requests the forecast, the weather service sends back a JSON file with the temperature, wind speed, and other details.
How to open and read a JSON file
Open a JSON file the same way you would open any text file. On Windows, right-click the file and choose "Open with" then select Notepad. On Mac, double-click the file and it will open in TextEdit, or right-click and choose "Open With" then "TextEdit". On Linux, use any text editor like gedit or nano.
For better readability, use a code editor like VS Code (free, from Microsoft), Sublime Text, or Atom. These programs color-code the different parts of JSON and can automatically indent it so the structure is easier to see. Some also warn you if punctuation is missing.
If a JSON file is very large or deeply nested, an online JSON viewer like jsoncrack.com or jsonvisio.com can display it as a diagram or tree, making it easier to understand the structure at a glance.
Why JSON uses strict punctuation rules
JSON requires exact punctuation because programs read it by parsing — breaking it down piece by piece according to strict rules. A missing comma, a misplaced bracket, or a quote mark in the wrong place will cause the file to fail. The program will either refuse to open it or skip the broken section.
This strictness is actually a feature, not a bug. It means that if something goes wrong, the error is clear and repeatable. A program can tell you exactly which line has the problem. With looser formats, errors can hide and cause unpredictable behavior later.
If you edit a JSON file by hand and it stops working, check for these common mistakes: missing commas between pairs, extra commas after the last item in a list, quotes around numbers or true-or-false values (numbers and booleans should not be quoted), or mismatched brackets.
JSON versus other data formats
JSON is not the only format for storing structured data. CSV (comma-separated values) is simpler but only works well for flat lists — like a spreadsheet with rows and columns. XML is older and more verbose, using tags like HTML. YAML is designed to be easier for humans to write by hand, using indentation instead of brackets.
JSON sits in the middle. It is more readable than XML, more structured than CSV, and easier for programs to parse than YAML. This balance is why it became the standard for web APIs and data exchange.
If you are choosing a format for your own project, JSON is a safe choice for anything that needs to be read by multiple programs or shared across the internet. For simple lists, CSV is faster to create. For documents with lots of text and formatting, XML or a document format like PDF makes more sense.
Editing JSON files safely
If you need to change something in a JSON file, make a backup copy first. Then open the file in a text editor and make your changes carefully. After you save, test the file by opening it in the program that uses it, or paste it into an online JSON validator to check for errors.
When editing by hand, remember that JSON is case-sensitive — "Name" and "name" are different labels. Strings (text values) must be in double quotes, not single quotes. Numbers and the values true, false, and null should never be quoted.
If you are not comfortable editing JSON directly, many programs that use JSON files have a user interface where you can change settings without touching the code. Check the program's settings or preferences menu first.
Frequently Asked Questions
Can I open a JSON file in Excel or Google Sheets?
You can import JSON into a spreadsheet, but the process depends on the structure. Simple arrays of objects (like a list of people with names and ages) import cleanly. Deeply nested JSON does not map well to rows and columns. Most spreadsheet programs have an import tool that will attempt the conversion, but you may lose some structure in the process.
What does it mean if I get a "JSON parse error"?
A parse error means the program tried to read the file and found something that does not follow JSON rules. This is usually a missing comma, an extra comma, mismatched brackets, or a quote mark in the wrong place. Check the line number the error gives you and look for punctuation mistakes near that spot.
Is JSON the same as JavaScript?
No. JSON is a data format that JavaScript can read natively, which is why it has "JavaScript" in the name. But JSON is not JavaScript code — it is just data. Other languages like Python, Java, and C# can read and write JSON just as easily as JavaScript can.
Can JSON files contain images or other binary data?
Not directly. JSON is text-only. If you need to store an image in JSON, you must convert it to text first — usually by encoding it in Base64, which turns binary data into a long string of characters. This makes the file larger and slower to process, so it is usually better to store the image separately and put a link to it in the JSON instead.
Why would a website ask me to download my data as JSON?
JSON is a neutral format that does not lock your data into one company's software. If you download your data as JSON, you can move it to another service, analyze it with different tools, or keep a backup in a format you control. It is also easier for you to understand what information the company actually has about you.