YAML
yaml to_jsonyaml to_jsonjson to_yamljson to_yaml

yaml to_json <yaml>


Description

    Convert a YAML document to JSON (the first document of the text)

Parameters

    yaml:   The YAML text - String - required
admin
yaml to_json "server: host: db.internal port: 5432 ssl: true retention_days: 30 reports: - name: sales cron: '0 6 * * 1' - name: stock cron: '0 7 * * *' updated: 2026-11-03"
mentdb
{"server": {"host": "db.internal", "port": 5432, "ssl": true}, "retention_days": 30, "reports": [{"name": "sales", "cron": "0 6 * * 1"}, {"name": "stock", "cron": "0 7 * * *"}], "updated": "2026-11-03"}

yaml to_json <yaml> <json_params>


Description

    Convert YAML to JSON with parameters: all (true: every document separated by --- in an array)

Parameters

    yaml:   The YAML text - String - required
    json_params:   The parameters - String - required
admin
yaml to_json "kind: Service name: api --- kind: Deployment name: api replicas: 3" "{\"all\": true}"
mentdb
[{"kind": "Service", "name": "api"}, {"kind": "Deployment", "name": "api", "replicas": 3}]

json to_yaml <json>


Description

    Convert JSON to YAML (block style, the strings that YAML would read as another type are quoted)

Parameters

    json:   The JSON - String - required
admin
json to_yaml "{\"server\": {\"host\": \"db.internal\", \"port\": 5432, \"ssl\": true}, \"flags\": [\"yes\", \"no\"], \"comment\": \"a: b\", \"empty\": null}"
mentdb
server: host: db.internal port: 5432 ssl: true flags: - 'yes' - 'no' comment: 'a: b' empty: null

json to_yaml <json> <json_params>


Description

    Convert JSON to YAML with parameters: indent (2)

Parameters

    json:   The JSON - String - required
    json_params:   The parameters - String - required
admin
json to_yaml "{\"jobs\": {\"build\": {\"steps\": [\"checkout\", \"test\"]}}}" "{\"indent\": 4}"
mentdb
jobs: build: steps: - checkout - test
Used in use cases (1 recipe)

    XML, HTML & Word integrator › Receive an XML order file: validate it against its XSD, convert it to JSON rows and to YAML
Often used with

    json to_rows  ·  xml to_json  ·  xml validate