Как конвертировать JSON в YAML
- Добавьте ваш файл .JSON - перетащите его в поле выше или нажмите, чтобы выбрать.
- Конвертируйте его в .YAML за несколько секунд.
- Скачайте ваш новый файл .YAML.
Чего ожидать
- The conversion is lossless - JSON objects, arrays, strings, numbers, booleans, and null all map exactly to YAML equivalents.
- YAML supports comments (lines starting with
#) but converters cannot add them for you; add comments manually after converting. - Bare YAML values such as
yes,no,on, andoffcan be misread as booleans by some parsers - check the output if your data contains these strings.
Часто задаваемые вопросы
Is converting JSON to YAML lossless?
Yes. JSON's data model is a strict subset of YAML's, so every key, value, and structure carries over exactly - nothing is dropped or changed.
Can I convert YAML back to JSON?
Yes, the reverse is equally lossless. With yq, run
yq -oj file.yaml > file.json.Why does my YAML parser reject the converted file?
The most common cause is tab characters used for indentation - YAML requires spaces only. This usually happens when a file is hand-edited after conversion; replace tabs with spaces and the parser should accept it.
Is a `.yaml` file the same as a `.yml` file?
Yes -
.yml and .yaml are both valid extensions for the same format and are accepted by all standard YAML parsers.