![]() |
JSON Parser
1.0
|
| json_member_list_t* json_path_locate | ( | list_object * | json_data, |
| json_member_list_t * | path_to_find, | ||
| const boolean | strict_path, | ||
| const boolean | suppress_errors | ||
| ) |
Using the internal representation of a JSON dotted notation path, trace the provided path and return the list_object or element found.
You can specify that the JSON path be followed precisely to find the JSON element, or you can ask for the path to be following in a more fuzzy method. For example if you are not sure if the top level JSON Object at the top of your path is actually at the top, or inside a top level array, then choosing a fuzzy approach to following the path will allow this function to try a few options to find the top segment of the specified path. After the first segment of the specified path, it is always followed strictly.
Following paths with a fuzzy approach, is the default.
If the JSON path you wish to locate is an absolute path, then you must also provide the root list_object for that JSON data block, or the search will fail, as absolute paths must originate from the top of the JSON tree. This function makes no distinction between absolute and relative paths, but the starting point will always dictate how successful a search is going to be.
| [in] | json_data | A D-List list_object that describes the JSON data to be searched. This can be a root list_object, or it can be any subordinate list_object within that hierarchy. It can be an Array or an Object list. The search is confined to the list(s) covered by this top level list_object. |
| [in,out] | path_to_find | a json_member_list_t struct that contains the path to follow, it is required that both .path_segments and .path[] fields be correctly filled in prior to calling this function. All the other fields of the json_member_list_t struct are ignored upon entry, and upon return will be filled in with the information about the new element, and the parent list_object that new element now belongs to. |
| [in] | strict_path | TRUE follow the provided path strictly, do not perform additional searches if the top segment of the path is not found at the first level of the starting point. |
| [in] | suppress_errors | TRUE do not output errors to stderr. FALSE output path and structure errors to stderr. Argument or coding errors will always be output to stderr. |
| Pointer | to the updated json_member_list_t that was provided as an input parameter. |
| NULL | If the element was not found, the path did not resolve to a findable element, then NULL is returned. |