Data · verktøy

JSON til CSV-konverterer

Lim inn en matrise med objekter og få CSV med én kolonne for hver nøkkel.

Kjøres i nettleseren. Ingen opplasting.

Use an array of JSON objects with a shared set of keys.

Om verktøyet

JSON til CSV-konverterer sem complicação.

Nestede verdier beholdes som JSON-tekst, og alle verdier escapes for CSV-utdata som passer i regneark.

Veiledning

Slik bruker du JSON til CSV-konverterer

JSON to CSV Converter turns an array of JSON objects into comma-separated text with one column for each key. Values with commas, quotes or line breaks are quoted for spreadsheets, and nested values are kept as JSON text. It does not split nested data into columns or save a file for you.

Slik gjør du

  1. Paste a JSON array of objects into the top box, for example an array holding one object with a name and an age.
  2. Press Convert to CSV. The first row holds the column names and each object becomes one row. A line under the buttons says how many rows were converted.
  3. Press Copy result and paste the text into a spreadsheet or a .csv file. Use Clear to start again.

Eksempler

Two simple records

Du skriver inn
JSON
[{"name":"Ada","age":36},{"name":"Alan","age":41}]
Du får
CSV
name,note,tags "Smith, Jo","said ""hi""","[""a"",""b""]"

The keys of the first object give the header row, and each object adds one line of values in the same order.

Kjørt med verktøyets egen kode.

Objects with different keys

Du skriver inn
JSON
[{"name":"Ada","city":"London"},{"name":"Grace","role":"Admiral"}]
Du får
CSV
name,city,role Ada,London, Grace,,Admiral

The columns are every key found anywhere, in the order they first appear. A key an object does not have becomes an empty cell.

Kjørt med verktøyets egen kode.

Commas, quotes and nested values

Du skriver inn
JSON
[{"name":"Smith, Jo","note":"said \"hi\"","tags":["a","b"]}]
Du får
CSV
name,note,tags "Smith, Jo","said ""hi""","[""a"",""b""]"

A cell with a comma, a quote or a line break is wrapped in quotes and inner quotes are doubled. The list in tags is written as JSON text in a single cell.

Kjørt med verktøyets egen kode.

A single object is refused

Du skriver inn
JSON
{"name":"Ada"}
Du får
Melding
Use a non-empty array of JSON objects.

Only a non-empty array whose items are all plain objects is accepted. Wrap a single object in square brackets to convert it.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Move API output into a spreadsheet so you can sort and filter it.
  • Turn a short list of records from a script into text that someone else can open in Excel or Sheets.
  • Look at the header row to see which keys appear across a set of objects.

Begrensninger

  • The input must be a non-empty array in which every item is a plain object. A single object, an array of numbers or an array that contains arrays is refused.
  • Nested objects and arrays are not split into columns. Each is written as JSON text inside one quoted cell.
  • Whole numbers above 9,007,199,254,740,991 keep all their digits, but other numbers go through the browser's JSON parser, so 1.50 is written as 1.5. Lines are separated by a plain line feed, and the page only offers Copy result, with no download button.

Tips

  • Put long IDs or phone numbers in the JSON as strings so that every digit is kept. Your spreadsheet may still reformat them when it opens the text.
  • Columns follow the order in which keys first appear, so put the columns you want first into the first object.
  • Check the header row for typos, because a misspelled key in one object creates an extra column.

Kilder

Vanlige spørsmål

Sobre JSON til CSV-konverterer.

How do I convert JSON to CSV?

Paste an array of objects, press Convert to CSV and copy the result. The header row lists the keys, and each object turns into one row of values separated by commas.

What happens if the objects have different keys?

The tool takes every key from every object, in the order first seen, and uses them all as columns. Where an object lacks a key, that cell is left empty.

How are nested objects and arrays handled?

They are not flattened. A nested object or array is written as JSON text and placed in one quoted cell, so you can still read it or split it later in a spreadsheet or script.

How are null, true and false written?

A null value and a missing key both give an empty cell. The values true and false are written as the words true and false, and strings are written as they are, with quotes added only when needed.

Why might accents look wrong in my spreadsheet?

The text has no byte-order mark, so some spreadsheet programs may guess the wrong encoding when they open a saved file. Import it as UTF-8, or paste the copied text straight into a sheet.

Is my data uploaded?

No. The conversion runs in your browser and the text is not sent anywhere. Do not paste private data on a shared computer, because it stays in the page until you press Clear.

Hvordan bruker du JSON til CSV?

Lim inn en matrise med objekter og få CSV med én kolonne for hver nøkkel.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.