Data Format Converter: JSON, XML, CSV, TSV and Subtitles

CSV to JSON

Serialisation writes a structure - records, fields, nesting - as a run of characters. JSON, XML, CSV and TSV are four ways to write the same structure down, and a conversion between any two is a question of what each format can and cannot say.

That is what every page here does. A conversion between two of them is not a calculation and it has no single right answer: it is a question of what the format you are writing can say about the document you are reading, and what it has to drop to say it. The cluster runs to 10 pages and covers two vectors — structured data (JSON, XML, CSV, TSV, plain text) and timed text (SubRip, WebVTT).

Subtitle files are timed text, not structured data. SubRip and WebVTT carry lines of prose against timestamps; they have no fields, no keys and no nesting, which is why they convert into each other and not into JSON. WebVTT was built on SubRip. The W3C specification's acknowledgements name the SubRip program's SRT file format as the basis for the WebVTT text track format, which is why the two convert into each other so cleanly.

Pick the pair you have below. Each of the 9 tools converts in your browser, shows the decision taken about every field, key or cue, and lists what the conversion could not carry.

The pairs people arrive looking for, with what each one is actually for.

All Data Format Converters

Every pair in the family, grouped by what the file is. The first group moves records and keys between formats; the second moves cues between two subtitle formats and nowhere else.

Data files
FromToTool
CSV JSON CSV to JSON
JSON CSV JSON to CSV
JSON plain text JSON to Text
JSON TSV JSON to TSV
JSON XML JSON to XML
TSV JSON TSV to JSON
XML JSON XML to JSON
Subtitle files
FromToTool
SubRip WebVTT SRT to VTT
WebVTT SubRip VTT to SRT

Which Converter Do I Need?

You have a file and you want it in another shape

Then the pair you want is in the grid above, and the page for it shows the mapping rule for every part of your document. Start from what you have rather than from what you want: the reading side is where the ambiguity lives.

You have one value rather than a document

Then this is the wrong family. A string to escape, a URL to encode or a run of bytes to write as Base64 is a value, not a serialised structure, and the text encoding converters handle those.

You have a subtitle track

Then use the subtitle pair, and expect nothing from the rest of the grid. A caption file has no field, no key and no nesting to map, so it converts into the other subtitle format and into none of the data formats.

FAQs About Data Format Conversion

What can a data format converter convert?

It moves the same data between JSON, XML, CSV, TSV and plain text, and it converts subtitle files between SubRip and WebVTT. Each pair has its own mapping rules, and each pair has its own page.

How to convert data into JSON format?

Pick the format you are starting from in the grid above. CSV and TSV take their keys from the first line; XML takes them from the element names and the declared prefixes.

What is the difference between CSV and TSV?

The delimiter, the quoting and the name line. CSV separates on a comma and can quote a field; TSV separates on a tab, cannot quote at all, and requires a name line.

Which formats keep nested data and which do not?

JSON and XML nest to any depth. CSV and TSV are flat records of fields, so a nested key has to be flattened into a dotted column name before it can be written.

Is a subtitle file a data format?

It is timed text rather than structured data. SubRip and WebVTT carry lines of prose against timestamps, with no fields and no keys, so they convert into each other only.