Home / Developer tools / CSV to JSON array

CSV to JSON Array

Get your CSV as a JSON array: an array of objects, an array of arrays, a flat list from one column or JSON Lines. Wrap it as JavaScript to paste straight into code.

Options

JSON result

Four kinds of array

LayoutLooks likeBest 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 lineLarge 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.

Frequently asked questions

How do I convert a CSV file to a JSON array?

Paste the CSV and choose Array of objects or Array of arrays. Copy the result or download it.

What is the difference between an array of objects and an array of arrays?

An array of objects repeats the column names in every row, which is clear but larger. An array of arrays is compact, and the names appear once in the header row.

What is JSON Lines?

It is a format with one JSON value on each line and no outer array. It can be read and written one line at a time, so it suits large files.

Can I get just one column as an array?

Yes. Choose Flat array and select the column.