What CSV to YAML does
CSV to YAML reads CSV and writes it as YAML. The input is parsed first, so a syntax error is reported with its position instead of producing broken output.
CSV to YAML examples
The built-in sample
Input
id,name,city
1,Ada,London
2,Lin,BengaluruOutput
- id: '1'
name: Ada
city: London
- id: '2'
name: Lin
city: Bengaluru
This is the input that the Load sample button fills in.
Values stay strings
Input
id,name,note
1,"Lovelace, Ada","said ""hi"""
2,LinOutput
- id: '1'
name: Lovelace, Ada
note: said "hi"
- id: '2'
name: Lin
note: ''
The ids are written as quoted strings ('1') so that a YAML parser does not turn them into numbers, and the empty field is written as an empty string.
Each output was produced by running this tool on the input above it.
How it works
Reading CSV. The first row is the header. Fields can be quoted to contain commas, line breaks and doubled quotes (""), following RFC 4180. Every following row becomes an object; all values are strings, and a row with fewer fields than the header is padded with empty strings.
Writing YAML. The result is written with js-yaml using two-space indentation. Strings are quoted only when they would otherwise be read as another type, such as a number or boolean.
Details and limits
- Values are carried across without losing anything in ordinary data; the points above list the cases the two formats handle differently.
- The result is a YAML list with one mapping per row, in the order of the file.
- Header names are used as keys exactly as written, including spaces; YAML quotes them where it has to.
- Input that is not valid CSV stops the tool, and the status line shows where the problem is. The CSV to JSON page lists the usual causes.
Questions
Is my data uploaded when I use CSV to YAML?
No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.
What does CSV to YAML do?
CSV to YAML reads CSV and writes it as YAML. The input is parsed first, so a syntax error is reported with its position instead of producing broken output.
Are there any limits I should know about?
The result is a YAML list with one mapping per row, in the order of the file. Header names are used as keys exactly as written, including spaces; YAML quotes them where it has to.
Is there a size limit?
There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.
Does it work on phones, and is it free?
Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.