JSON2YAML(1)

πŸ“¦ version 3.0.1.3, in arch rolling, ubuntu resolute, ubuntu stonking

✨ json2yaml β€” bestie's guide to turning JSON into conf2-compatible YAML ✨

okay so picture this: you're a json2yaml(1) girlie living in a JSON world, and you need your config files to speak YAML so conf2 modules can read them. that's literally the whole job. no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

json2yaml [-h] [-oOUTPUT_DIR] SOURCE...

πŸ’– DESCRIPTION πŸ’–

this little icon converts your JSON configuration files into YAML format that's compatible with conf2 modules. it can do the cute low-key thing where you hand it one single JSON file, or it can go full main character and recursively convert all the JSON files inside directories. either way, output files keep their original names and just get a .yaml extension slapped on the end. periodt. πŸ’…


✨ OPTIONS ✨

  • -h, --help β€” shows the help message and dips out. classic.
  • -o OUTPUT_DIR, --output OUTPUT_DIR β€” tell it where to drop the goods. the default is ~/yaml πŸŽ€
  • SOURCE... β€” the JSON file(s) or directory path(s) you want processed. you need at least one, bestie, it can't read your mind πŸ™ˆ

🧚 CONVERSION RULES 🧚

  • JSON objects become nested YAML structures 🌈
  • all values gain metadata fields:
    • _default: the original value
    • _type: type indicator ('s' for scalar, 'as' for arrays)
  • array values get converted into string representations (iykyk)
  • the output version is fixed to 2.0.0.0-0k0.0 β€” not negotiable, it's giving very set-in-stone πŸ’€

πŸ‘‘ OUTPUT πŸ‘‘

files land as <original_name>.yaml in the output directory. slay.

πŸŽ€ Structure πŸŽ€

<filename>:
  2.0.0.0-0k0.0:
    <key1>:
      _default: <value>
      _type: <s|as>
    <key2>: ...

🌱 ENVIRONMENT 🌱

  • HOME β€” used when the default output directory (~/yaml) is specified 🏠

πŸ’œ EXAMPLES πŸ’œ

convert a single file:

json2yaml /etc/app/config.json

convert a directory with a custom output:

json2yaml -o ~/converted /path/to/json_configs/

convert multiple sources:

json2yaml file1.json file2.json ~/legacy_configs

πŸ”₯ EXIT STATUS πŸ”₯

  • 0 β€” success πŸŽ‰
  • 1 β€” input errors (invalid files/paths) 😭
  • 2 β€” processing errors πŸ’€

⭐ NOTES ⭐

  • original JSON arrays become string values in YAML, fr fr
  • nested objects are preserved recursively β€” nothing gets lost, we don't do that here 🫢
  • non-JSON files are skipped with a warning. not me ignoring the irrelevant ones πŸ’…

🌈 SEE ALSO 🌈

conf2(1), jq(1), yq(1)


πŸ’– AUTHOR πŸ’–

UKUI Configuration Tools Team πŸ‘‘


okay that's the whole page bestie, go forth and convert 🌸

and that's a wrap!! brought to you by v1.1, dated 2025-07-24 β€” the json2yaml era, iconic, no notes πŸ’…βœ¨

πŸ“¦ where this page comes from