What is a .json file?
JavaScript Object Notation · Code and data · Douglas Crockford · 2001
JSON is the most common format for exchanging structured data between programs and web APIs. It is plain text made of key-value pairs and lists, easy for both humans and machines to read, which is why it powers most modern web services.
What is a .json file used for?
JSON represents data as objects (key-value pairs in braces) and arrays (lists in brackets). It is concise, unambiguous and maps neatly onto the data structures of nearly every programming language.
It replaced XML for most web APIs because it is lighter and easier to read. Config files, app settings and API responses are frequently JSON.
Being plain text, a JSON file opens in any editor. Formatting it with indentation, known as pretty-printing, makes large files far easier to scan.
What opens a .json file?
The .json format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- Notepad++
- VS Code
- any text editor
macOS
- VS Code
- TextEdit
- any editor
Linux
- VS Code
- nano
- any editor
Web
- Browsers show raw JSON; dev tools format it
Open a .json file step by step
- Confirm the file really is a .json. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with Notepad++ or VS Code.
- On Mac, use VS Code or TextEdit.
- On Linux, try VS Code or nano.
- Still stuck? Convert the .json to CSV, which opens more widely.
Why can't I open my .json file?
Almost always because no installed app understands JSON. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .json at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
How to convert a .json file
You can convert a .json file to CSV, XML, YAML.
jq converts JSON to CSV in a single pipeline and Python's json plus csv modules do it in five lines. Flattening to CSV forces a decision about nested objects and arrays, which is where the data loss happens.
What is the .json file signature (magic bytes)?
A .json file may start with the hex bytes 7B, which read as { in ASCII. Those bytes are a hint rather than a guarantee, so JSON cannot be identified by its header alone.
These are the documented signatures for JSON.
| Hex signature | Offset | ASCII | Note |
|---|---|---|---|
| 7B | 0 | { | '{' object (usually) |
| 5B | 0 | [ | '[' array |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .json file?
JSON is the most common format for exchanging structured data between programs and web APIs. It is plain text made of key-value pairs and lists, easy for both humans and machines to read, which is why it powers most modern web services.
How do I open a JSON file?
Any text editor works. For a formatted, colour-coded view, open it in VS Code or drop it into your browser's developer tools.
Why does my JSON file say invalid?
JSON is strict: keys need double quotes, no trailing commas, and no comments. A validator will point to the exact line that breaks the rules.
Comparisons
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.