JSON representation
SLX-OS supports JSON format to represent the resource. This section provides information on the JSON representation for the YANG elements.
- The YANG elements in the resource models are be mapped into JSON elements for the proper serialization.
- A leaf element is mapped into a single key-value pair. The key and the value are separated by a colon.
- A container element is mapped into a JSON object. Thus, the equivalent representation of a container starts with a left curly bracket and ends with a right curly bracket. The elements within the container are separated a comma.
- A list element is mapped into a JSON array. Thus, the equivalent representation of the list starts with a left square bracket and ends with a right square bracket. The instances of the list element are separated by a comma.
The following is an example of JASON representation.
{
"sflow": {
"enable": "true",
"collector": [
{
"collector-ip-address": "1.1.1.1",
"collector-port-number": "6343",
"use-vrf": "mgmt-vrf",
},
{
"collector-ip-address": "1.2.3.4",
"collector-port-number": "23",
"use-vrf": "mgmt-vrf",
}
],
"polling-interval": "12",
"sample-rate": "32",
}
}