Go to the documentation of this file.
121 #ifndef __JSON_PARSER_H__
122 #define __JSON_PARSER_H__
131 namespace VirgilIoTKit {
135 #define MOD_ERROR_START(x) (x << 12 | 0)
137 #ifdef JSMN_SHORT_TOKENS
145 #define VS_JSON_ERR_OK 0
int num_tokens
Number of tokens available for parser.
Definition: json_parser.h:203
@ WM_E_JSON_INVAL
Invalid characters in JSON.
Definition: json_parser.h:155
@ WM_E_JSON_ERRNO_BASE
Definition: json_parser.h:149
int json_array_get_bool(jobj_t *jobj, uint16_t index, bool *value)
Get JSON bool value from array.
char * js
Pointer to JSON string.
Definition: json_parser.h:197
int json_array_get_composite_object(jobj_t *jobj, uint16_t index)
Get JSON composite object from array.
bool json_is_array(jobj_t *jobj)
Find out if the current object is a JSON Array.
wm_json_errno
Json Error Codes.
Definition: json_parser.h:148
void json_parse_stop(jobj_t *jobj)
Stop JSON Parsing.
int json_array_get_float(jobj_t *jobj, uint16_t index, float *value)
Get JSON float value from array.
@ WM_E_JSON_INVALID_JOBJ
Invalid JSON object.
Definition: json_parser.h:159
int json_get_val_str_len(jobj_t *jobj, char *key, int *len)
Get JSON string length.
@ WM_E_JSON_FAIL
Generic JSON parse failure.
Definition: json_parser.h:151
json_parser_t parser
Internal JSON parser object.
Definition: json_parser.h:195
int json_get_val_bool(jobj_t *jobj, char *key, bool *value)
Get JSON bool value.
jsmntype_t jsmnenumtype_t
Definition: json_parser.h:142
Object used by the JSON parser internally.
Definition: json_parser.h:193
bool json_is_object(jobj_t *jobj)
Find out if the current object is a JSON Object.
jsmn_parser json_parser_t
Definition: json_parser.h:186
jsmntok_t jsontok_t
JSON token.
Definition: json_parser.h:179
@ WM_E_JSON_INVALID_INDEX
Invalid array index given.
Definition: json_parser.h:165
@ WM_E_JSON_INCOMPLETE
Incomplete JSON string.
Definition: json_parser.h:157
@ WM_E_JSON_INVALID_TYPE
JSON element of invalid type.
Definition: json_parser.h:163
int json_array_get_int(jobj_t *jobj, uint16_t index, int *value)
Get JSON integer value from array.
#define MOD_JSON
Definition: json_parser.h:124
int json_array_get_str(jobj_t *jobj, uint16_t index, char *value, int maxlen)
Get JSON string value from array.
@ WM_E_JSON_OBUF
JSON buffer overflow.
Definition: json_parser.h:171
int json_parse_start(jobj_t *jobj, char *js, size_t js_len)
Start JSON Parsing.
jsontok_t * cur
Pointer to current active JSON token.
Definition: json_parser.h:201
int json_get_val_str(jobj_t *jobj, char *key, char *value, int max_len)
Get JSON string value.
@ WM_E_JSON_INVALID_JARRAY
Invalid search array provided.
Definition: json_parser.h:167
int json_get_val_int(jobj_t *jobj, char *key, int *value)
Get JSON integer value.
int json_get_val_int64(jobj_t *jobj, char *key, int64_t *value)
Get 64bit JSON integer value.
int json_array_release_array_object(jobj_t *jobj)
Release a JSON array object from an array.
int json_array_get_array_object(jobj_t *jobj, uint16_t index, int *num_elements)
Get JSON array object from array.
int json_release_composite_object(jobj_t *jobj)
Release a JSON composite object.
int jsmnindex_t
Definition: json_parser.h:141
int json_get_composite_object(jobj_t *jobj, char *key)
Get JSON composite object.
int json_init(jobj_t *jobj, jsontok_t *tokens, int num_tokens, char *js, size_t js_len)
Initialize the JSON Parser and parse the given JSON string.
int json_get_val_float(jobj_t *jobj, char *key, float *value)
Get JSON float value.
int json_release_array_object(jobj_t *jobj)
Release a JSON array object.
jsontok_t * tokens
Pointer to JSON tokens array.
Definition: json_parser.h:199
#define MOD_ERROR_START(x)
Definition: json_parser.h:135
@ WM_E_JSON_NOMEM
Insufficient memory to hold the results.
Definition: json_parser.h:153
int json_array_release_composite_object(jobj_t *jobj)
Release a JSON composite object from an array.
int json_array_get_str_len(jobj_t *jobj, uint16_t index, int *len)
Get JSON string length from array.
@ WM_E_JSON_NOT_FOUND
JSON element not found.
Definition: json_parser.h:161
int json_array_get_num_elements(jobj_t *jobj)
Get number of elements in an array.
@ WM_E_JSON_INVSTART
Invalid json start.
Definition: json_parser.h:169
int json_get_array_object(jobj_t *jobj, char *key, int *num_elements)
Get JSON array object.
int json_array_get_int64(jobj_t *jobj, uint16_t index, int64_t *value)
Get 64bit JSON integer value from array.