Monday, December 28, 2020

Data Formats: Understanding and using JSON, XML and YAML




 gagabit.json 


{

    "ietf-interfaces:interface": {

        "name": "GigabitEthernet2",

        "description": "Wide Area Network",

        "enabled": true,

        "ietf-ip:ipv4": {

            "address": [

                {

                    "ip": "192.168.1.2",

                    "netmask": "255.255.255.0"

                }

            ]

        }

    }

}


 gigabit.xml 

 

<?xml version="1.0" encoding="UTF-8" ?>

<interface xmlns="ietf-interfaces">

  <name>GigabitEthernet2</name>

  <description>Wide Area Network</description>

  <enabled>true</enabled>

  <ipv4>

    <address>

      <ip>192.168.1.2</ip>

      <netmask>255.255.255.0</netmask>

    </address>

  </ipv4>

</interface>


 gigabit.yaml

---

ietf-interfaces:interface:

  name: GigabitEthernet2

  description: Wide Area Network

  enabled: true

  ietf-ip:ipv4:

    address:

    - ip: 192.168.1.2

      netmask: 255.255.255.0

  


address_list.json 


{

  "addresses": [

    {

      "ip": "192.168.1.2",

      "netmask": "255.255.255.0"

    },

    {

      "ip": "192.168.1.3",

      "netmask": "255.255.255.0"

    },

    {

      "ip": "192.168.1.4",

      "netmask": "255.255.255.0"

    }

  ]

}


address_list.xml


<?xml version="1.0" encoding="UTF-8" ?>

<addresses>

  <ip>192.168.1.2</ip>

  <netmask>255.255.255.0</netmask>

</addresses>

<addresses>

  <ip>192.168.1.3</ip>

  <netmask>255.255.255.0</netmask>

</addresses>

<addresses>

  <ip>192.168.1.4</ip>

  <netmask>255.255.255.0</netmask>

</addresses>


address_list.yaml 


---

addresses:

- ip: 192.168.1.2

  netmask: 255.255.255.0

- ip: 192.168.1.3

  netmask: 255.255.255.0

- ip: 192.168.1.4

  netmask: 255.255.255.0



  

 

No comments:

Post a Comment