There is a limited JSON parsing functionality implemented with the qapi_JSON_... functions.
For example lets have the following JSON data:
{
"known_key1" : "with value 1",
"known_key2" : "with value 2"
}
"known_key1" : "with value 1",
"known_key2" : "with value 2"
}
After decoding with the qapi_JSON_Decode() function we get the internal handle to read out the JSON values. With the qapi_JSON_Query_By_Key(handle, "known_kex1", &value) or qapi_JSON_Query_By_Index(handle, 0, &value) functions we can get the proper values.
But lets assume we would like to parse an arbitrary JSON structure with arbitrary keys. For example:
{
"arbitrary_key1" : "with value 1",
"arbitrary_key2" : "with value 2"
}
"arbitrary_key1" : "with value 1",
"arbitrary_key2" : "with value 2"
}
We might call the qapi_JSON_Query_By_Key(handle, ???, &value), but what do we set for the key value?
On the other hand if we use the qapi_JSON_Query_By_Index(handle, 0, &value) function we get the value, but we do not know then which key it belongs to.
Is there any support for reading out arbitrary JSON key/value pairs? Can we get somehow iterate through a list of arbitrary JSON entries and get both the keys and related values?
Based on the QCA402x QAPI Specification 80-Y9381-7 Rev. H released on May 6, 2019 this doesn't seem viable.
Best regards,
Monika Kiss
Kindly refer to json_demo.c file and let us know if this helps.
Path : @target\quartz\demo\QCLI_demo\src\enc\json_demo.c