YAML
YAMLは視認性が高い。
JSONはprogramming上の扱いが簡単。
構文
プログラマーのための YAML 入門 (初級編)
こちらがわかりやすい
YAML では、主に次の 3 つの組み合わせでデータを表現します。 配列、ハッシュ、スカラー
YAML is a superset of JSON
相互変換のツールもたくさんある。
jsonは、コメント不可、エスケープ規則が強いなどがあるが、
What is the difference between YAML and JSON? When to prefer one over the other - Stack Overflow
Technically YAML is a superset of JSON. This means that, in theory at least, a YAML parser can understand JSON, but not necessarily the other way around.
JSON同士の比較はYAMLが良い - WEBツール(JS)で「JSON⇒YAML」変換時に完全なエスケープ戻しを目指す - Qiita
yq
kislyuk/yq: Command-line YAML and XML processor - jq wrapper for YAML/XML documents
CommandLineで jqみたいなもの?
yamlをparseして、jqにpipeすると。
$ cat hoge.yaml|yq ".|length" #例
あと、yq -y でyamlでのoutputだが、yamlのformatにwell-formedでないと(たぶん)いけない。
Colorize the output? · Issue #134 · mikefarah/yq not yetだそう。
$ tree -L 2 -J |yq -y .
で、ディレクトリ構造のyaml化。
command tree
-J で json化
-Iで、 " Do not list those files that match the wild-card pattern. " だけど、
ディレクトリも除外対象。説明からはディレクトリの除外がないと思ったが、、、
参考:
JSON, YAML, ini, TOML ざっくり比較
#parser