Starting points for your own code. Run them in the environment shown below.
Node.js 22+ · ES module (.mjs)
Current inputs apply only to fields used by the example. Selected files are not embedded.
Install dependencies
npm install papaparse
import Papa from "papaparse";
const input = 'name,note\nAlice,"hello, world"';
const parsed = Papa.parse(input, { header: true, skipEmptyLines: true });
if (parsed.errors.length) throw new Error(JSON.stringify(parsed.errors));
console.log(JSON.stringify(parsed.data, null, 2));
console.log(Papa.unparse(parsed.data));
Put it to work
Convert tabular data between CSV and JSON arrays.
Details that matter
Format and meaning
The first CSV row defines column names. Values stay strings. JSON input must be an array of flat objects.
Supported scope and limits
Text 1 MB
Split inputs that exceed the limit. If a format or algorithm is unsupported, choose a tool that matches your requirements instead of silently changing the format.