Verifiable example
This JSON contains an object, a number, a boolean, a string that looks like a number and an array:
{
"service": {
"name": "api",
"port": 8080,
"active": true,
"version": "1.0",
"tags": ["production", "private"]
}
}
The result preserves the structure and types:
service:
name: api
port: 8080
active: true
version: '1.0'
tags:
- production
- private
version remains in quotes because in the original JSON it was text, not a
number.
How it works
Paste a document and press Convert to YAML or use Ctrl/⌘ + Enter. The
tool first checks the JSON syntax, preserves the order of the
properties and generates YAML in block style with two indented spaces.
Simple strings are displayed without quotes. Those that could be confused
with numbers, booleans, null or dates remain cited to preserve their
type. Numbers are written from their original text, so an integer
large does not go through a floating point conversion.
The guide how to convert JSON to YAML without losing types explains what check on ambiguous strings, large numbers, collections and applications of destiny.
You can then copy the result or download it as a .yaml file. Everything is
runs within this tab, without network, storage or data requests
added to the URL.
Common uses
- Prepare a configuration for Docker Compose or Kubernetes.
- Pass data from an API to a file that is more convenient to review.
- Create the basis of a CI workflow that uses YAML.
- Convert JSON examples for technical documentation.
The conversion changes the representation, not the meaning of the values. Even Thus, it is advisable to validate the result with the application that is going to consume it, because each tool can apply additional rules to its configuration.
Common errors
- Trailing commas: JSON does not allow a comma before
}or]. - Single quotes: JSON properties and strings use quotes doubles.
- Comments: JSON does not support
//or/* ... */. - Post manual indentation: YAML depends on spaces; when editing the result should not mix tabs with the generated indentation.
If the input is invalid, the tool displays the first problem and its location when the browser can determine it. For further diagnosis verbose, use the JSON validator.
Borderline cases
- Empty objects and arrays are represented as
{}and[]. - Objects, arrays, strings, numbers, booleans and
nullas root are supported. - Unicode and escaped line breaks are preserved.
- Large integers keep all their figures.
- Duplicate property names are preserved, although some readers YAML can reject them.
- Input is limited to 1,000,000 characters and 100 levels of nesting to protect the tab.
- JSON does not contain comments, anchors or aliases, so the tool you can’t invent them in the YAML.
Frequently asked questions
Do JSON and YAML represent exactly the same types?
Both can represent objects, lists, text, numbers, booleans and values null. YAML also offers constructs that JSON does not have. This conversion is limits to the data set present in JSON and quotes ambiguous texts.
Can I convert a file with comments?
Not like strict JSON. Delete comments or make them properties of text before processing it. The tool does not interpret JSON5.
Is my configuration sent to a server?
No. Validation and serialization run locally in the browser. The entry is not saved, is not recorded, and disappears when you close or reload the app. page.