R12.1-2025July30
Define a JSON Table Parser
JSON Table parser is used to parse standard JSON-formatted text, such as Cisco ACI, AWS, and more. It requires certain coding know-how to use this type of parser. In the parsing process, the standard JSON text is parsed into a tree structure with nodes, and JSON paths (connection between the root node and the current node) are established. The parsed results in table form are generated based on path mapping (the path scope is defined by user) and the key mapping variables selected.
![]() |
Note: JSON Table type is primarily used for API parser (which uses API command as parser input data source). |
Follow the steps below to create a JSON Table parser:
- Create a new parser, then name it.
- Define the basic settings for retrieving standard JSON-formatted text.
- Define the settings to retrieve API command data from the API adapter Cisco ACI on the device apic1.
Note: When the API parser is selected, ensure that the selected device has a front server configured. If a front server is not defined for the device, configure it before proceeding. - Click Function to define the python script. This will decide how to get data from the API server.
The sample Python script is shown below:Python'''
Begin Declare Input Parameters
[
]
End Declare
'''
def BuildParameters(context, device_name, params):
get_dn = GetDeviceProperties(context, device_name, {'techName': 'Cisco ACI', 'paramType': 'SDN', 'params' : ['dn','role'] })
dn = get_dn['params']['dn']
role = get_dn['params']['role']
rtn_params = [{ 'devName' : device_name, 'dn' : dn, 'role': role }]
return rtn_params
def RetrieveData(rtn_params):
dn = rtn_params['dn']
role = rtn_params['role']
url = '/api/mo/' + dn + '/sys/proc.json'
rtn_params['url'] = url
data = getData(rtn_params)
return json.dumps(data,indent=4)
- Define the settings to retrieve API command data from the API adapter Cisco ACI on the device apic1.
- Click Retrieve to retrieve JSON-formatted text.
Alternatively, you can manually input JSON-formatted text in the left Sample Data pane. Click Edit Sample from the format menu, then manually input/edit the parser input. - After the input text is ready, you can continue to define the JSON table type in the right pane. Select Json Table from the + New Pattern menu to create a JSON Table type.
- In the By Path block, select a path from the By Path tree structure to determine which table section in the JSON-formatted text will be parsed. The JSON keys selected in the next step come from the table section determined in the JSON-formatted text.
- In the Define Variable by Selecting JSON Key block, click
to display the JSON Key tree, then select JSON key as parser variable, then you can change the variable type.
Tip: You can click to add more variables using JSON Key.
- View the parsed results: For a JSON Table type parser, the parsed results are in table format, which are displayed in the Output area.
- Click the save icon
to save the parser.