JSON parser functions

group group_json_func

The JSON parser utility library provides helper functions to parse JSON objects.

Functions

cy_rslt_t cy_JSON_parser_register_callback(cy_JSON_callback_t json_callback, void *arg)

Register callback to be invoked by JSON parser while parsing the JSON data.

Return

cy_rslt_t

Parameters
  • [in] json_callback: : Pointer to the callback function to be invoked while parsing the JSON data

  • [in] arg: : User argument passed in when registering the callback

cy_JSON_callback_t cy_JSON_parser_get_callback(void)

Returns the current callback function registered with the JSON parser.

Return

cy_JSON_callback_t

cy_rslt_t cy_JSON_parser(const char *json_input, uint32_t input_length)

Parse the JSON data.

This function will parse the JSON input string through a single parse, calling a callback whenever it encounters milestones an object, passing in object name, JSON value type, and a value (if value is string or number )

note

: Currently escape values are not supported.

Return

cy_rslt_t

Parameters
  • [in] json_input: : Pointer to the JSON data

  • [in] input_length: : Length of the JSON data pointed by json_input1