All tools (39)
YAML to JSON
Convert YAML into JSON, including multi-document streams.
Several documents become a JSON array.
Paste YAML to convert it to JSON.
YAML to JSON
Paste YAML and get JSON. Anchors and aliases are resolved, block scalars are unfolded, and a syntax error tells you which line it is on rather than just failing.
Multi-document streams
A YAML file can hold several documents separated by ---, which is how a single Kubernetes manifest describes a Deployment and a Service together. JSON has no equivalent, so with that option on, several documents become a JSON array and one document stays a plain object.
Things YAML has and JSON does not
- Comments are dropped - JSON has no syntax for them.
- Dates become ISO 8601 strings.
- Anchors and aliases are expanded, so a value referenced three times appears three times.
- Non-string keys become strings, because JSON object keys always are.
Is this a YAML validator too?
Effectively yes. If the YAML parses, you get JSON; if it does not, you get the parser's error with its position. That covers the usual culprits: a tab used for indentation, a missing space after a colon, or a value that needed quoting.
Related tools
- JSON to YAML - the other direction.
- JSON Formatter - format or minify the result.
- JSON to TypeScript - generate types from the converted output.