When we communicate, we basically transmit and receive information between each other. Every time we do it, we obey a set of rules like talking in the same language, structuring our speech in sentences, start the conversation with a greeting, etc. If we don't use a common set of rules we won't be able to understand each other.

Data Formats Language Rules

The same applies to communication between applications. When two software programs exchange data, this data has to be structured using the same language otherwise, the applications won't be able to understand each other. We humans are very good at making sense of unstructured data, but applications have to be told explicitly how to parse data. Examine the following three examples:

1. InterfaceGigabit0/0/0vlan2010.1.1.1255.255.255.0

2. Interface Gigabit0/0/0
vlan20
10.1.1.1.
255.255.255.0

3. Interface Gigabit0/0/0
10.1.1.1 255.255.255.0
vlan20

How an application is supposed to understand when the interface name ends and the IP address starts? This is why we use pre-defined data formats when storing or transmitting data and the process of translating clear text data to pre-defined data format is called data serialization.

Data Formats XML

Data serialization is the process of translating data into a format that can be stored (in a file or memory buffer) or transmitted (across an IP network) and reconstructed later (possibly via different computer languages and in a different computer environment).
When the data is reconstructed on the other end according to the serialization format, it can be used to create a semantically identical clone of the original data object.

Remember - Data formats like XML, JSON, and YAML don't do anything on their own. They are only used to represent data into well defined structured way.

Look at the following examples. They represent the same information, just written in a different data format, using the rules of the language it is written in. They may look different, but the information is basically the same.

CLI

!
interface GigabitEthernet0/0/0
 description VLAN20
 ip address 10.1.1.1 255.255.255.0
 ip mtu 1400
 duplex full
 speed 1000
!

 

XML

<?xml version="1.0" encoding="UTF-8"?>
<interfaces>
  <interface>
    <name>GigabitEthernet0/0/0</name>
    <description >VLAN20</description >
    <address>10.1.1.1</address>
    <mask>255.255.255.0</mask>
    <MTU>1400</MTU>
    <duplex>full</duplex>
    <speed>1000</speed>
  </interface>
</interfaces>

 

JSON

{
   "interfaces":[
      {
         "name":"GigabitEthernet0/0/0",
         "description ":"VLAN20",
         "address":"10.1.1.1",
         "mask ":"255.255.255.0",
         "MTU ":"1400",
         "duplex ":"full",
         "speed ":"1000"
      }
   ]
}

YAML

--- 
- GigabitEthernet0/0/0: 
    description: VLAN20
    address: "10.1.1.1"
    mask: "255.255.255.0"
    MTU: 1400
    duplex: full
    speed: 1000

 

Let's look at the most common text-based data format:

  • XML (Extensible Markup Language) - Nested textual format. Human-readable and editable. Schema-based validation. Widely used in the networking and automation space. Also very popular in web services.
  • CSV (Comma-Separated Values) - Table structure with delimiters. Human-readable textual data. It usually opens as spreadsheets or plaintext. Used as plaintext database. In Networking it is often used when exporting or importing data into monitoring applications.

Full Content Access is for Registered Users Only (it's FREE)...

  • Learn any CCNA, DevNet or Network Automation topic with animated explanation.
  • We focus on simplicity. Networking tutorials and examples written in simple, understandable language for beginners.