JSON to YAML
json_to_yamlConvert JSON text or files into YAML with selectable 2- or 4-space indentation, optional key sorting, multi-document output, and precise error reporting.
Instructions
Convert JSON to YAML (js-yaml dump: no line wrapping, no anchors; strings that would read as numbers/booleans are quoted). Options: 2 or 4 space indent, sort keys, and write a top-level array as a multi-document YAML stream (--- per item). Invalid JSON gives line and column. Give "text" or a file "path". Web version: https://s3eidat.github.io/yaml-json/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Or: a path to a JSON file (UTF-8; use this for big inputs). | |
| text | No | The JSON as inline text. | |
| indent | No | Indentation: 2 or 4 spaces. | |
| output | No | Optional: also write the result to this file path (or folder ending in "/"). The result text is then left out of the reply. Results over 1,000,000 characters are always written to a file. | |
| sortKeys | No | Sort mapping keys alphabetically. | |
| multiDocument | No | A top-level JSON array becomes one YAML document per item. |