name: OLTool version: '2.0' tags: - json - yaml - toml config: theme: dark indent: 2
About Data Format Converter
Development constantly involves converting between JSON, YAML, TOML, XML, and CSV: migrating config files, exporting API data, modeling tabular data, or mashing formats together in a pipeline. Instead of hopping between a dozen one-way tools, this one brings them together. Pick a source and target format, paste once, and convert in any direction, with a one-click swap that feeds the output back as input for round-trip checks. For example, JSON {"name":"Tom","age":20} becomes YAML name: Tom / age: 20, or back again, with nesting preserved automatically. A few caveats keep results predictable: CSV export needs an array of objects and treats the first row as the header on import; YAML's implicit type inference can reinterpret strings like on or date-like values as booleans or timestamps. And extremely nested inline TOML or namespaced XML is best handled by the dedicated tools. Everything runs locally, so sensitive config and API data never leave your machine. Round-tripping is the most practical self-check and the premise most often skipped. Convert to the target format and back, then compare field count, nesting and value types item by item, which immediately exposes lost fields, flattened nesting or rewritten types. It costs little and blocks the great majority of silent data loss. Nested structures need a decision rather than a default. A flat format cannot express deep nesting, so choose: spread into columns, serialise into a text field, or explode into rows. The three affect downstream very differently — spreading grows the column count with the data, serialising requires the consumer to parse text, and exploding multiplies the record count. Its boundary with specialised converters: a general tool suits simple structures and pure shape changes, while fields with specific semantics such as dates, money and encodings are safer in a specialised tool that carries the relevant rules. A general converter typically moves those as strings without checking whether the meaning survived. Size and performance deserve an early estimate. General conversion parses fully and serialises wholesale, so very large files consume a lot of memory, while streaming requires record-by-record processing. Decide by scale: tens of megabytes handled whole, hundreds suggesting sharding or a streaming tool. Finally, validate on two levels. Structural validation confirms fields and nesting are intact, and business validation confirms values still obey the rules, such as enumerations remaining within the allowed set and required fields not becoming empty. Structural checks alone miss type and semantic changes, which surface only when something downstream breaks. Numeric precision is the least visible hazard across formats. Each format represents numbers differently, so an integer beyond the representable range is rounded during conversion — an identifier past a certain length gets rewritten — and floating values can differ in the last digit after a round trip. Carry precision-sensitive fields such as identifiers, amounts and timestamps as strings in the target format. Key order and duplicate keys also matter. Most text formats do not guarantee key order semantically, so some conversions reorder them, and duplicate keys are handled inconsistently across parsers, some taking the last and others failing outright. Where downstream depends on order or the source has duplicates, normalise before converting, or one input yields different results across environments.
How It Works Internally
A general converter parses the source into a tree and emits it under the target rules. Differences in expressiveness force compromises: a flat format cannot represent deep nesting and must either spread it into columns, serialise it into text or explode it into rows. A successful conversion therefore shows only that it parses, not that the information survived, so nesting levels need checking item by item.
A three-level nested object converted to a tableThe nesting is flattened or serialised into a cell; confirm the consumer can rebuild the levels, or the structure is lostMeasured on This Page
| JSON→YAML | Parses back to an equal object (name/version/tags/config all match) |
|---|---|
| JSON→TOML | tomllib round-trips to an equal object — TOML requires quoted strings, so 2.0 must be "2.0" or it becomes a float |
| JSON→XML | ElementTree parses it; <name>OLTool</name> and <config> are present |
| JSON→CSV | First row has name=OLTool; nested objects are serialised into cells — CSV is inherently a 2-D grid, so nested structures must flatten |
| YAML→JSON | Reverse direction parses to matching fields (name=OLTool, tags=["json"]) |
| Visible failures | A source syntax error surfaces as a message rather than silently producing nothing |
Know the capability gaps: CSV is only a 2-D table (no nesting, and numbers are indistinguishable from strings); XML has no array concept (lists become repeated elements, and attribute-versus-element choices affect round-trip fidelity); TOML has no null (JSON null has nowhere to go and is usually dropped or stringified); only JSON and YAML are structurally close to equivalent, and YAML additionally carries anchors and references. So lossless conversion between arbitrary formats does not exist — check whether the target can express the source before converting.
How to Use
- Open "Data Format Converter"
- Pick the source format: JSON, YAML, TOML, XML or CSV
- Paste or edit on the left; the right pane converts live
- Switch the target format, or use the swap arrow between them
- Copy the result from the output pane's copy button
Use Cases
- Migrate config files — Convert a YAML config to TOML or JSON when the toolchain on the other end only accepts one of them.
- Export API data — Convert a JSON API response to CSV and import it straight into Excel or analytics tools.
- Cross-format comparison — View the same data as JSON or YAML to quickly understand structural differences.
- Tabular to structured — Convert a CSV table into a JSON array of objects for frontend rendering or API mocks.
- Integrate legacy XML — Turn XML into JSON for modern frontends, or generate XML payloads in reverse.
- Transform env files — Convert a flat .env key-value list into JSON or YAML for structured config injection in containers.
- Generate sample data — Write a quick CSV table in a spreadsheet, then convert to JSON objects for API mock endpoints.
FAQ
Which conversions are supported?
Any-direction conversion among JSON, YAML, TOML, XML and CSV, using a unified JS object as the intermediate representation.
Any requirements for CSV?
Exporting CSV requires an array of objects (one object per row); the tool uses the union of fields as headers. When importing CSV, the first row is treated as the header.
Do TOML/XML support complex structures?
Common tables, arrays, nesting and attributes are supported. For extremely complex TOML (e.g. nested inline tables) or namespaced XML, use the dedicated tool.
What does the swap button do?
It swaps the source/target formats and moves the current output into the input box, making round-trip conversion and verification easy.
Can types be lost during conversion?
Most scalars are faithfully preserved, but YAML's implicit type inference and the differing support for null and attributes in TOML/XML can turn a few values into strings — verify key fields afterward.
Is my data uploaded?
No. All parsing and serialization happens locally in your browser, making it safe for configs or API data that contain sensitive fields.
Fields go missing or nesting is flattened after conversion. What now?
The two formats differ in how much nesting they can express, and a flat format cannot represent deep structure, so the conversion necessarily involves choices. Decide up front how nested fields map: spread into columns, serialised into one text field, or exploded into rows. With automatic conversion, check each level for flattening rather than only confirming that the output parses, since parsing and preserving meaning are different things.
Does round-tripping between JSON/YAML/TOML change my data?
Semantically no, but representation differs: quoting rules, date syntax and multiline text all vary. Round trips preserve data except YAML anchors and comments, which have no JSON/TOML equivalent and are dropped.