# jc.parsers.yaml jc - JSON CLI output utility `YAML` file parser Usage (cli): $ cat foo.yaml | jc --yaml Usage (module): import jc.parsers.yaml result = jc.parsers.yaml.parse(yaml_file_output) Compatibility: 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' Examples: $ cat istio-mtls-permissive.yaml apiVersion: "authentication.istio.io/v1alpha1" kind: "Policy" metadata: name: "default" namespace: "default" spec: peers: - mtls: {} --- apiVersion: "networking.istio.io/v1alpha3" kind: "DestinationRule" metadata: name: "default" namespace: "default" spec: host: "*.default.svc.cluster.local" trafficPolicy: tls: mode: ISTIO_MUTUAL $ cat istio-mtls-permissive.yaml | jc --yaml -p [ { "apiVersion": "authentication.istio.io/v1alpha1", "kind": "Policy", "metadata": { "name": "default", "namespace": "default" }, "spec": { "peers": [ { "mtls": {} } ] } }, { "apiVersion": "networking.istio.io/v1alpha3", "kind": "DestinationRule", "metadata": { "name": "default", "namespace": "default" }, "spec": { "host": "*.default.svc.cluster.local", "trafficPolicy": { "tls": { "mode": "ISTIO_MUTUAL" } } } } ] ## info ```python info() ``` ## process ```python process(proc_data) ``` Final processing to conform to the schema. Parameters: proc_data: (List of Dictionaries) raw structured data to process Returns: List of Dictionaries. Each dictionary represents a YAML document: [ { YAML Document converted to a Dictionary See https://pypi.org/project/ruamel.yaml for details } ] ## parse ```python parse(data, raw=False, quiet=False) ``` Main text parsing function Parameters: data: (string) text data to parse raw: (boolean) output preprocessed JSON if True quiet: (boolean) suppress warning messages if True Returns: List of Dictionaries representing the YAML documents.