Guides / Dev utilities
How to Convert Between JSON, YAML and CSV
Last reviewed October 12, 2026
JSON, YAML and CSV all hold structured data, but each is made for a different job. Moving data between them comes up all the time, from turning an API response into a spreadsheet to converting a config file. Here is how to do it with Anvil, and what to watch for.
Convert data in four steps
- Open Dev utilities and choose the json / yaml / csv tab.
- Choose the format your data is in and the format you want.
- Paste your data into the input box.
- Press Convert and copy the result.
What each format is for
- JSON is the standard for web APIs and application data. It is strict and easy for programs to read.
- YAML is built for humans, with indentation instead of braces and support for comments. It is common in configuration files for tools such as Docker Compose, Kubernetes and CI pipelines.
- CSV is a flat table of rows and columns that opens directly in Excel, Google Sheets and database import tools.
Turning JSON or YAML into CSV
CSV is a flat table, so the data has to be a list of records that share the same fields. A JSON array of objects such as a list of customers, each with a name, email and city, converts cleanly: each object becomes a row and the keys become the column headings.
The column names are taken from the first record. Every other record should use the same keys. Nested objects and arrays do not fit in a flat table, so flatten them first, for example by turning an address object into separate street and city fields.
Turning CSV into JSON or YAML
The first row of the CSV is used as the column names, and each following row becomes an object. All values are read as text, so a number such as 42 arrives as the string 42. If your program expects real numbers or booleans, convert those fields afterwards.
Make sure the first row really is a header, and that fields containing commas are wrapped in double quotes, as spreadsheet programs do automatically when they export.
Fixing common errors
- Could not parse the input: check the syntax. For JSON, look for a missing comma, a trailing comma, single quotes instead of double quotes, or an unclosed bracket. For YAML, look for tabs, which are not allowed, and inconsistent indentation.
- CSV output requires a list of objects: the data is a single object or a plain list of values. Wrap the object in a list, or choose JSON or YAML as the output instead.
- A column is missing: that key was not in the first record. Make sure the first record contains every field you need.
Do not paste passwords, API keys or private data into any online tool. Text you submit is sent to Anvil's server for processing and not stored, but it is safest to remove secrets first.
Try it now
Open the Dev utilities tool. It is free, needs no account, and your files are deleted right after conversion.