Four kinds of array
| Layout | Looks like | Best for |
|---|---|---|
| Array of objects | [{"id":1,"name":"Alex"}] | APIs, JavaScript, databases. Every value has its name. |
| Array of arrays | [["id","name"],[1,"Alex"]] | Charts, tables and compact files. The header can be the first row. |
| Flat array | ["Alex","Sam"] | One column as a list, for example names, ids or tags. |
| JSON Lines | {"id":1} on each line | Large files, logs and streaming. Each line is a complete JSON value. |
Flat array from one column
Choose Flat array and pick the column. You get a plain list, such as ["Alex Morgan","Sam Lee"]. Type detection applies, so a column of numbers gives a list of numbers.
JSON Lines (NDJSON)
JSON Lines puts one JSON object on each line, with no commas and no outer brackets. A program can read it one line at a time without loading the whole file, which is why log tools, big data tools and many import APIs use it. It is also easy to append to. The file extension is .jsonl, and the tool offers it when you download.
Paste it into code
Choose a wrapper and the result is ready for a JavaScript file:
- const data = ...; for a script or a console.
- export default ...; for an ES module you import.
Same options as the main converter
Delimiter detection, type detection, empty value handling, nested keys and the indent all work here as in the CSV to JSON converter. If you need an object keyed by an id, or an object of columns, use that page.
Related pages: JSON to CSV, CSV to JSON online and the CSV vs JSON guide. You can also compare two results with the JSON diff tool.