Automation tools exchange structured data, not screen output. Three formats cover almost everything on the CCNA. They all carry the same idea - keys and values, lists, and nesting - but look different.
JSON
JSON (JavaScript Object Notation) is the most common, especially in REST. { } is an object (keys and values), [ ] is a list (array). Strings are in double quotes; values can be numbers, true/false, or null. Commas separate items; no comma after the last one.
{
"interface": {
"name": "GigabitEthernet0/1",
"enabled": true,
"speed": 1000,
"addresses": [
{ "ip": "10.1.1.1", "mask": "255.255.255.0" }
],
"vlans": [1, 10, 20]
}
}YAML
YAML is easier for people to write - no braces, just indentation (spaces, never tabs). A list item starts with -. Ansible playbooks are YAML.
interface:
name: GigabitEthernet0/1
enabled: true
speed: 1000
addresses:
- ip: 10.1.1.1
mask: 255.255.255.0
vlans:
- 1
- 10
- 20XML
XML wraps every value in opening and closing tags. It's older and more verbose; NETCONF uses it.
<interface>
<name>GigabitEthernet0/1</name>
<enabled>true</enabled>
<speed>1000</speed>
<address>
<ip>10.1.1.1</ip>
<mask>255.255.255.0</mask>
</address>
</interface>Common mistake: The commonest JSON error is a stray comma after the last item in an object or list, or single quotes instead of double. YAML's commonest error is a tab instead of spaces, or crooked indentation.
Remember: JSON: braces and brackets, double quotes, no trailing comma. YAML: indentation and dashes. XML: open/close tags. Same data, three looks.