YAML Converter
Convert YAML locally into structured JSON or normalized YAML and flat configuration text, with path and type checks that expose lossy transformations.{{ report.converted_text }}
| Path | Type | Value preview | Copy |
|---|---|---|---|
| {{ row.path }} | {{ row.type }} | {{ row.preview }} |
Configuration data often needs to move between a format people can review and a format another program expects. YAML is popular for the first job because indentation makes nested mappings and sequences compact. JSON, INI, environment-variable files, and Java properties use different structures, so conversion is also a decision about which parts of the original model can survive.
YAML documents contain mappings, ordered sequences, and scalar values such as strings, numbers, booleans, and null. A stream may contain several documents separated by ---. Comments, anchors, aliases, quoting choices, and block-scalar style help authors express or maintain the source, but they are not all portable data values.
The destination matters most when nesting is involved. JSON and regenerated YAML can preserve nested containers. Line-oriented formats usually need every scalar leaf flattened into a name such as service.host or SERVICE_HOST. Empty mappings and sequences have no natural scalar assignment, and two different paths can become confusing after punctuation is normalized.
| Destination | Keeps nesting | Main review point |
|---|---|---|
| JSON | Yes | A multi-document stream becomes one top-level array. |
| Normalized YAML | Yes | Values remain, but presentation details are regenerated. |
| INI | No | The first path segment becomes a section and later segments become a key. |
| Environment variables | No | Paths become normalized names; optional prefix and case rules change those names. |
| Java properties | No | Each scalar path becomes one assignment line. |
How to Use This Tool:
Choose the destination before adjusting presentation options because structured and flat outputs preserve different information.
- Paste YAML into YAML source, drop one YAML, YML, or TXT file, or load the sample. Correct any indentation, quoting, unsupported-value, or document-separator error shown below the editor.
- Select Output format. Use JSON or normalized YAML when nested containers must remain intact; choose INI, .env variables, or Java properties only when a flattened scalar view fits the receiving system.
- Open Advanced only when key order, indentation, path notation, an environment prefix, letter case, or the visible ledger limit needs to change. Sorting affects mapping keys but never sequence order.
- Read the summary and review notes, then compare Converted config with the Path ledger. The ledger is especially important for flat output because it reveals the path assigned to every scalar value.
Interpreting Results:
The converted text is a regenerated representation, not a byte-for-byte rewrite. Check the reported document count, key count, scalar count, maximum depth, and output line count for an unexpected structural change. The Type profile can also expose a value that parsed as a boolean, number, null, or string when another type was intended.
A successful parse does not prove that the destination application will accept the result. Review names in flat formats for collisions and confirm the receiving program's own rules for sections, quoting, case, duplicate keys, and environment-variable syntax.
Technical Details:
Conversion begins by parsing the stream with a JSON-compatible YAML schema. The accepted data model is limited to mappings with string keys, sequences, finite numbers, booleans, strings, and null. Cyclic aliases, non-finite numbers, parser-specific objects, an empty stream, or a document with no scalar leaves cannot produce a valid conversion result.
Transformation Core:
The same parsed value tree feeds every destination. This prevents each serializer from interpreting the YAML independently.
- Normalize line endings and parse every non-empty document in the stream.
- Traverse mappings and sequences to build scalar paths, count keys and value types, and measure maximum depth.
- Optionally sort mapping keys alphabetically. Array order always remains unchanged.
- Serialize the tree directly for JSON or normalized YAML, or project scalar paths into assignment names for INI, environment variables, and properties.
| Rule | Effect |
|---|---|
| Dot path | Mapping keys join with a period and sequence indexes use brackets, as in servers[0].port. |
| Slash path | Segments join with a slash; literal tilde and slash characters are escaped as ~0 and ~1. |
| Environment name | Dots, slashes, brackets, and other punctuation become underscores; repeated underscores collapse and an optional normalized prefix is prepended. |
| INI projection | The first normalized path segment becomes the section. Remaining segments form a lowercase underscore-separated key. |
| Flat scalar | Null becomes null; booleans and numbers use their text form; strings with line breaks, equals signs, or edge whitespace are JSON-quoted. |
JSON output represents multiple YAML documents as one array. Normalized YAML writes each document with a leading ---. Both use an indentation setting from 2 to 8 spaces. The input is limited to 100,000 characters, the environment prefix to 32 characters, and the visible path ledger to 25 to 1,000 rows. Limiting visible rows does not reduce the underlying scalar counts.
Privacy and Accuracy Notes:
Parsing and conversion happen in the browser, and source text is excluded from the page URL. Local processing reduces transmission risk, but configuration files may still contain passwords, tokens, private hosts, or personal data. Generated output does not preserve comments, anchors, aliases, original scalar style, or hand formatting; flat formats also cannot preserve empty containers as native structures.
Worked Examples:
Nested service settings
For YAML containing service.name, service.replicas, and service.tls, JSON keeps the nested service object. Environment output instead produces three assignment names. Adding the prefix APP and keeping uppercase names turns the host-style path into a name such as APP_SERVICE_NAME. Review the ledger before using the flat file because the nesting itself is no longer present.
References:
- YAML 1.2.2 Specification, YAML Language Development Team, October 2021.
- RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format, Internet Engineering Task Force, December 2017.