JSON / YAML Converter

Convert JSON to YAML and simple block YAML back to JSON, with validation and formatting - useful when the same config exists in both forms.

Converter Converters & Formatters Runs in your browser
Try:

Result

Input
152 chars of JSON
Output
115 chars of YAML
Top-level keys
4
YAML
hostname: bng-edge-01
loopback: 10.255.0.1
bgp:
  asn: 65001
  peers:
    - 192.0.2.2
    - 192.0.2.6
enabled: true
JSON (reformatted)
{
  "hostname": "bng-edge-01",
  "loopback": "10.255.0.1",
  "bgp": {
    "asn": 65001,
    "peers": [
      "192.0.2.2",
      "192.0.2.6"
    ]
  },
  "enabled": true
}

About JSON / YAML Converter

Network automation lives in both formats: APIs speak JSON, Ansible and Kubernetes speak YAML, and the same device inventory often has to exist in both. This converts between them with validation, in the browser.

Where automation tooling expects each format

Device APIs, RESTCONF and NETCONF-over-JSON gateways speak JSON. Ansible inventories and playbooks, Kubernetes manifests, GitLab and GitHub pipelines, and Netplan all use YAML. That split means the same device inventory frequently exists in both, and hand-converting is where drift is introduced. Converting mechanically also normalises formatting, which makes a subsequent diff show real changes rather than reindentation noise.

YAML gotchas worth knowing

YAML's type inference is aggressive. Unquoted yes, no, on and off become booleans - the notorious "Norway problem" where the country code NO becomes false. Leading zeros can be read as octal, and version strings like 1.10 become the number 1.1. Quote any string whose meaning matters, which for network data means interface names, VLAN lists and version numbers.

Common use cases

  • Turning an API response into a YAML fragment for an automation repository.
  • Validating a YAML inventory file before a playbook run.
  • Reformatting minified JSON into something reviewable.

Edge cases and gotchas

  • Tabs are illegal for indentation in YAML - always spaces.
  • JSON has no comments; converting YAML to JSON discards them silently.

Frequently asked questions

Does converting to JSON lose anything?
Comments and any anchors or aliases, because JSON has no equivalent for either. Keep the YAML file as the source of truth and treat JSON as a generated artefact.
Is YAML a superset of JSON?
YAML 1.2 is, so any valid JSON is valid YAML. The reverse is not true, which is why YAML-to-JSON can lose comments and anchor structure.