CSV to JSON

Use a CSV header to turn the following records into named JSON properties.

Use a CSV header to turn the following records into named JSON properties.

How to use

  1. Paste the full sample, including the quoted line break and the last record.
  2. Convert the table to JSON and inspect the objects in the resulting array.
  3. Find the first note and verify that the final record appears as its own object.

Worked example

Input

id,note
001,"line 1
line 2"
002,"Hello, world"

Expected result

[{"id":"001","note":"line 1\nline 2"},{"id":"002","note":"Hello, world"}]

Check the result

The embedded newline remains inside the note, and cell values such as leading-zero IDs stay strings.

Continue with another guide

Cookie
We care about your data and would love to use cookies to improve your experience.

Learn how we use cookies