JSON converters
JSON (JavaScript Object Notation) is the text format most web APIs, apps and configuration files use for data. Values can be nested: a record can hold another record or a list, which a flat table cannot.
Convert JSON
What to know about JSON
- Objects hold named values, lists hold values in order; both can be nested to any depth.
- Values are text, numbers, true/false or null, so a postcode written as "0150" stays text.
- JSON Lines (.jsonl, .ndjson) puts one JSON object on each line, common in logs and data exports.
- Text is always Unicode, normally UTF-8.
File extensions: .json, .jsonl, .ndjson
Where you meet JSON files
Almost every web API answers in JSON, so it is what you get when you export data from a web app, download records from an open-data portal or save the response of a request. Configuration files for VS Code, npm (package.json) and many other tools are JSON, and Google Takeout, Facebook and Instagram data downloads deliver much of their content as JSON files. GeoJSON, the common format for map data on the web, is JSON with an agreed structure for coordinates.
JSON compared with other formats
- JSON or CSV
- CSV is one flat table that Excel opens directly. JSON keeps nesting, lists and the difference between a number, text, true/false and empty (null). Export JSON to CSV when people need to sort and filter the records in a spreadsheet; keep JSON when the data goes back into a program.
- JSON or GeoJSON
- GeoJSON is JSON in which every record is a Feature with a geometry and its properties. Map programs such as QGIS and Leaflet read GeoJSON directly, but not arbitrary JSON with latitude and longitude fields.
Common problems with JSON files
"Unexpected token" or "Expected property name" errors
JSON is strict: names and text must use double quotes, the last item of a list or object cannot have a trailing comma, and comments are not allowed. Files written by hand or copied from JavaScript often break one of these rules. The error message gives the line and column; look just before that position.
Excel cannot open the JSON file directly
Excel does not open JSON as a sheet the way it opens a CSV. Power Query (Data, Get Data, From File, From JSON) can load it, but nested records need to be expanded column by column. Converting to CSV first flattens nested fields into columns such as address.city. Tool: Convert JSON to CSV.
Large numbers or IDs change
JavaScript and many tools read JSON numbers as 64-bit floating point, which is exact only up to 9,007,199,254,740,991. Longer IDs, for example from Twitter/X or some databases, get their last digits changed. APIs avoid this by also sending the ID as text (such as an id_str field); use that field when it exists.
The file is one JSON object per line
Logs, BigQuery and many data exports use JSON Lines (.jsonl or .ndjson): one complete object on each line, without surrounding brackets. A normal JSON parser rejects the whole file. Read it line by line, or use a tool that accepts JSON Lines. Tool: Convert JSON to CSV.
Questions about JSON
What program opens a JSON file?
Any text editor, such as Notepad, TextEdit or VS Code. Firefox shows JSON files as a collapsible tree, and VS Code can format them with Format Document. To work with the records as a table, convert them to CSV or load them with Power Query in Excel.
Does JSON have a date type?
No. Dates are stored as text, usually in ISO 8601 form such as 2024-05-01 or 2024-05-01T14:30:00Z, or as a number of seconds or milliseconds since 1970. The program reading the file decides how to interpret them.
Is JSON the same as a JavaScript object?
Nearly, but JSON is a stricter subset: it has no functions, no undefined, no comments and no single quotes, and names must be quoted. That makes it easy for every programming language to read, not only JavaScript.