Data model comparsion – XML/JSON/YAML

This is the first article from a series on the Cisco DevNet Associate exam (DEVASC 200-901). I’m currently preparing for this exam, so in the following weeks, I’ll be publishing articles about the exam topics.

Compare data formats (XML, JSON, and YAML)

Cisco DEVASC 200-901 exam topic covered in this article

Data model

A data model is an abstract representation of data object. It describes how particular object structure should look like:

  • what attributes are needed
  • how they are named
  • what are default values of attributes

The data models ensures consistency, and they are easy to work with while writing automation tasks.

Why do we use data models?

They come in handy when we have two or more independent systems that need to communicate with each other. Data models are standardized, so if the system encodes data in one of the well-known formats(such as XML/JSON/YAML), the other can easily decode and use it for its own purpose.

Types of data models

There are many data models available, but in this article, I’ll focus on three of them – XML, JSON, and YAML.


XML is the abbreviation of Extensible Markup Language. As the name suggests, it’s a markup language, that defines an encoding format that is readable both for humans, and the machines.

XML can be compared to the HTML, which is used to encode websites. The main difference between those standards is that XML is mainly used to store data, HTML on the other hand to display data. HTML has it’s own predefined tags, in the XML you can define tags according to your need. It’s also worth to mention, that XML is a case sensitive language.

XML is used in the NETCONF protocol.


JSON is a language-independent data interchange format. It’s derived from the JavaScript programming language. It can be easily read by humans and parsed by machines. JSON is case sensitive. There are two structures used in JSON:

  • name/value pairs – similar to Python’s dictionaries
  • an ordered list of values – similar to Python’s lists

You will face JSON while working with REST API.


YAML is a human-friendly, data serialization format. It stands out with minimal syntax compared to the XML and JSON. YAML is case sensitive and it doesn’t allow to use tab characters. It’s built around three data types:

  • scalars – strings and numbers
  • sequences – similar to Python’s lists
  • mappings – similar to Python’s dictionaries

YAML is commonly used in the configuration files, for example, Ansible playbooks are written in YAML.

Ansible is an automation tool that can be used by network engineers.


Since we know what a data model is, and what are the characteristics of XML, JSON, and YAML, let’s jump to the examples. As network engineers, we might want to have a database of our network devices. Every network device has attributes such as the hostname, ip, vendor, etc. If we make a data model of a network device, we can keep our data in a standardized way, and build a consistent database.

Here is the list of attributes of our network device:

  • Hostname
  • IP address
  • Vendor
  • Model
  • OS version

Now we have all attributes we want, so it’s time to build a data models.




  "Switch1" : {
    "hostname": "Cisco-1",
    "ip": "",
    "vendor": "Cisco",
    "model": "C2960X",
    "os_version": "15.2(2)E7"


    hostname: Cisco-1
    vendor: Cisco
    model: C2960X
    os_version: 15.2(2)E7 


In this article, we’ve briefly touched the data models topic. In the following weeks, I’ll publish more articles on various topics such as NETCONF, REST API, etc, when those data models will be used in practice. If you want to know how to parse XML, JSON, and YAML in the python, check this article.


2 thoughts on “Data model comparsion – XML/JSON/YAML

Leave a Reply

Your email address will not be published. Required fields are marked *