Skip to content
English
The WorkbenchTools that upload nothing
A workshop by the ODERSA associationNothing leaves, nothing is kept, nothing reaches us.

The workshop · CSV and JSON

How it works : CSV and JSON

The fact almost nobody mentions: “the CSV format” is not a standard. Its reference document is marked “informational” and says itself that there are considerable differences among implementations. That is why this tool MEASURES the separator instead of assuming it, and shows you what it found.

Open the tool

The direction of the conversion is DEDUCED from what you paste: text that starts with a brace or a bracket is JSON, everything else is CSV. It is the same logic as the encrypted vault and the protected PDF on this site: we do not ask you to pick a mode you do not know.

CSV is a format without a standard, and that is the source of nearly all the trouble. The reference document is marked “informational”, and it says itself that there are considerable differences among implementations. On a European spreadsheet the separator is a semicolon, because the comma is the decimal separator there. So the tool MEASURES the separator: it tries the four candidates and keeps the one that gives the most regular column count, then it shows you which one it kept.

The rules in the reference document are applied to the letter, including the one half the converters get wrong: a field wrapped in quotes may contain a LINE BREAK. That is why the reader moves character by character instead of splitting the text into lines. A quote inside a wrapped field is doubled, and the tool writes it that way in the other direction.

How it works

  1. Paste your CSV, or your JSON. The tool recognises which one and shows the direction of the conversion.
  2. Check the separator it measured, and the first header row. Those are the only two things that can fool a converter.
  3. Copy or download the result. The table tells you how many rows and columns were read.

Formats accepted

The direction is deduced from the text. JSON has to be an array of objects to give a two dimensional table: that is the shape almost every export produces.

Text in CSV format

Separator measured among comma, semicolon, tab and vertical bar. Quoted fields, doubled quotes and line breaks inside a field are all handled.

Text in JSON format

An array of objects gives one row per object and one column per key encountered. A nested value is written as JSON in its cell, and the tool says so.

See the compatibility matrix

Its limits

There is no CSV standard, and the tool does not pretend otherwise

The 2005 reference document is classed as “informational”: it DESCRIBES an observed practice, it does not standardise it, and it says itself that there are considerable differences among implementations. The practical consequence: a file one program accepts another may refuse, and that is nobody's fault. The tool applies the rules in that document and shows what it measured, so you can judge.

Multi level JSON does not become multi level CSV

A CSV is a flat table: two dimensions, not three. When a value is itself an object or a list, the tool writes it as JSON in its cell and tells you, which keeps the information without pretending to have flattened it. Picking a flattening convention on your behalf, with invented column names, would be a decision that is not ours to make.

Number conversion is offered, and it can damage an identifier

A postcode starting with a zero, a phone number, a nineteen digit identifier: turning them into numbers loses the leading zero or the last digits. The box is ticked by default because that is what you want from a file of measurements, but untick it for a file of references: everything will stay as text.

The byte order mark is offered for CSV, and not by accident

One very widely used spreadsheet only displays a UTF-8 CSV correctly if the file starts with that mark: its own documentation says so. Without it, accented letters turn into strings of odd signs. But that same mark makes other programs fail, reading it as a character in the first field. There is no universally right choice: the box exists, and its reason sits beside it.

Questions about this tool

Is my data sent anywhere?

No, and it matters: a CSV file is nearly always an export of real data, often with names and addresses in it. Check it in thirty seconds: open the inspector with the F12 key, the “Network” tab, clear the list, then paste your file and convert. Not one line appears. Cut your connection and do it again.

My CSV uses semicolons, is that a problem?

No, and it is in fact the commonest case in Europe. Since the comma is the decimal separator there, spreadsheets use the semicolon to separate columns. The tool tries all four possible separators and keeps the one giving the most regular column count, then tells you which it kept. If its measurement gets it wrong, impose the separator from the list.

My postcodes are losing their leading zero.

Untick “convert anything that looks like a number into a number”. A postcode, a phone number, an account number are not numbers: they are strings of digits, and treating them as numbers loses the leading zero. The box is ticked by default because that is what you want from a file of measurements, but it unticks with one click and everything stays as text.

Why are accented letters broken when I open the CSV in my spreadsheet?

Because one very widely used spreadsheet only recognises UTF-8 in a CSV if the file starts with a byte order mark: that is written in its own documentation. Tick the box that adds it and reopen the file. Watch out for the reverse: that same mark makes some programs fail, reading it as a character in the first field. There is no universally right choice, only the one that suits the destination.

My JSON has objects inside objects. What happens to that structure?

It is kept, but written as JSON inside the cell, and the tool tells you. A CSV is a flat, two dimensional table: there is no universal way to fit a three level structure into it. Conventions exist, they invent column names like “address.city”, and each one is an arbitrary choice. We would rather keep your data intact and tell you where it is.