Data Format Converter
Convert data between JSON, YAML, XML, TOML, TOON, CSV, TSV, MessagePack, JSON5, JSONL, INI and Java properties instantly as you type, right in your browser.
Input
Output
Readme
What are these data formats?
Programs store and exchange structured data, such as settings, records, and lists, in text formats that each write it in their own way. A converter is handy when one program gives you data in a format that another one doesn't read, or when a format is easier to read or edit for the job at hand.
| Format | How it writes data | Where you see it |
|---|---|---|
| JSON | Objects in braces, lists in brackets, text in double quotes | Web APIs and app settings |
| YAML | Indented key: value lines, list items starting with - |
Docker Compose, Kubernetes, and CI pipeline files |
| XML | Elements in tags, which can have attributes | Documents, RSS feeds, and SOAP web services |
| TOML | key = value lines under [table] headers |
Config files such as Cargo.toml and pyproject.toml |
| TOON | Indented lines, with lists of records as rows under their fields | Structured data sent to AI language models |
| CSV | A header row, then one line per record, values split by commas | Spreadsheets and database exports |
| TSV | Like CSV, with tabs between the values | Cells copied from a spreadsheet |
| MessagePack | Binary data, shown here as hexadecimal bytes | Compact messages between programs |
| JSON5 | JSON that also allows comments, single quotes, and unquoted keys | Hand-written config files |
| JSONL | One JSON value per line, also called JSON Lines or NDJSON | Logs and datasets |
| INI | key = value lines under [section] headers |
Settings files of programs, such as php.ini |
| Properties | key = value lines with dotted keys |
Java apps, such as Spring Boot's application.properties files |
Tool description
This tool converts data between these 12 formats: JSON, YAML, XML, TOML, TOON, CSV, TSV, MessagePack, JSON5, JSONL, INI, and Java properties. Every data format converter here works the same way, from the general Data Format Converter to the ones for a single pair, such as JSON to YAML, CSV to JSON, or XML to JSON: it starts on the formats in its name, and the Source and Target menus switch to any other. Paste or type your data, and the result appears as you type in a code editor with syntax highlighting, ready to copy. The swap button turns the conversion around and makes the result the new input.
When the input isn't valid in the source format, the error message says what's wrong, usually with the line and column of the problem.
Your data is converted in your browser and never uploaded.
Example
This JSON:
{
"users": [
{ "id": 1, "name": "Ann", "admin": true },
{ "id": 2, "name": "Bo", "admin": false }
]
}becomes this YAML:
users:
- id: 1
name: Ann
admin: true
- id: 2
name: Bo
admin: falsethis CSV, with one row per user:
id,name,admin
1,Ann,true
2,Bo,falseand this TOON:
users[2]{id,name,admin}:
1,Ann,true
2,Bo,falseHow the formats map to each other
Formats don't all hold the same kinds of data, so some conversions follow these rules:
- CSV and TSV hold a table. The first row names the columns, and each other row becomes an object. Nested objects become columns named by their path, and lists become JSON text in their cell, so
{"name": "Ann", "address": {"city": "Oslo"}, "tags": ["a", "b"]}becomes the columnsname,address.city, andtags. Converted back, those columns become nested objects and lists again. When the data is an object that holds one list, such as{"users": [...]}, the rows are the items of that list, and a list of lists becomes rows without a header. - Text values: CSV, TSV, XML, INI, and properties hold only text, so the converters turn
trueandfalseinto true and false, and numbers written plainly, such as42or3.5, into numbers. Values such as007,1.50, or1e3stay text, so zip codes and version numbers keep their exact form. - XML attributes become keys that start with
@, and the text of an element that has attributes becomes#text:<price currency="USD">44.95</price>becomes{"@currency": "USD", "#text": 44.95}. Repeated elements become a list. Converting to XML, keys that start with@become attributes again. An object with a single key whose value isn't a list becomes the root element. Other data goes inside a<root>element, with each item of a list at the top in an<item>element. Characters that XML names can't have, such as spaces, become_. - TOML, INI, and properties can only hold named values at the top, so data that's a list is written under the name
items, and a single value undervalue. TOML has no null, so null values are left out. - INI writes nested objects as sections, such as
[server.ssl], lists of values askey[] = valuelines, and lists of objects as sections named by their position, such as[users.0]. - Properties keys join nested names with dots and number list items in brackets, such as
app.hosts[0], the way Spring Boot writes them. Converted to YAML or JSON, those keys become nested objects and lists, so anapplication.propertiesfile converts to the layout of anapplication.ymlfile. Characters outside Latin-1 are written as\uescapes. - YAML results quote text that YAML 1.1 readers would read as something else, such as
on,yes, or a date, so that YAML 1.1 and YAML 1.2 readers get the same data. A YAML file with several documents separated by---becomes a list of them, and<<merge keys are filled in. - MessagePack is binary, so the tools read and write it as hexadecimal bytes:
{"a": 1}is81 A1 61 01. The input can have spaces, commas, and0xbefore each byte. Several messages one after another become a list. - JSONL results have each item of the list on its own line.
- Whole numbers too big for JavaScript numbers, such as 64-bit IDs, keep all of their digits.
- TOML dates and times, and MessagePack timestamps, become text such as
1979-05-27T07:32:00Z.
Tips
- To convert cells from a spreadsheet, copy them and paste them as TSV: spreadsheet apps copy cells as tab-separated text.
- CSV and TSV fit data that's a list of similar records. Deeply nested data reads better as YAML, TOML, or TOON.
- Comments in YAML, XML, TOML, JSON5, INI, and properties files aren't kept, since the converters carry over only the data.