API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IJSONTREE_PATHGET()

Brew Release
Brew MP 1.0.2
Description
The function provides a generic mechanism to access any nested JSON value using the path string format described below.
The format uses period (".") as the separator and hence strings with periods cannot use this function for lookup. The string is divided into multiple segments with each segment except the last pointing to an object or array name. The last segment identifies the leaf node; for objects this would be the name of the key and for arrays an index number.

Examples: JSON: { "Address" : { "Street Name" : { "Name": "Main Blvd", "Number": 1111 }}} Path: "Address.Street Name.Number" Retrieves: 1111
JSON: [0, 1, { "x" : 234} ] Path: "2.x" Retrieves: 234
JSON: { "auth": { "options" : ["rc4", "aes"] } } Path: "auth.options.0" Retrieves: "rc4"
Params
me
[]:
pointer to the IJSONTree Interface object
pjvRoot
[]:
root object to start from - must be an array or object
cpszPath
[]:
path in the format described above
ppjv
[]:
filled with the found JSValue
Interface
Prototype
  •    int IJSONTree_PathGet(IJSONTree *me, JSValue *pjvRoot, const char *cpszPath,
                             JSValue** ppjv);
     
Return
  • AEE_SUCCESS : on success IJSONTree_EBADTYPE : pjvRoot is neither an array nor an object AEE_ENOMEMORY : if out of memory