cueOS  2.4
cueOS - Universal Show Control OS for ARM
json_parser.h
1
8#ifndef JSON_PARSER_H_
9#define JSON_PARSER_H_
10
11#define JSON_ARRAY_DELIMITOR "["
12#define JSON_ARRAY_TERMINATOR "]"
13#define JSON_STRING_DELIMITOR "{"
14#define JSON_STRING_TERMINATOR "}"
15#define JSON_STRING_ENTRY_DELIMITOR "\""
16#define JSON_STRING_ENTRY_SEPARATOR ":"
17#define JSON_STRING_PAIR_SEPARATOR ","
22typedef struct{
23 char *key;
24 char *val;
26
30typedef struct{
32 uint16_t param_count;
34
38typedef struct{
39 char *data;
40 uint16_t len;
42
43
44void json_parser_json_string_put_int_pair(json_parser_json_string_s *json_string, char *key, uint16_t val, uint8_t is_initial, uint8_t is_final);
45void json_parser_json_string_put_str_pair(json_parser_json_string_s *json_string, char *key, char *val, uint8_t is_final, uint8_t is_initial);
46void json_parser_json_string_nest(json_parser_json_string_s *json_string, char *key, json_parser_json_string_s *nested_json_string, uint8_t is_initial, uint8_t is_final);
47void json_parser_json_string_put_array_object(json_parser_json_string_s *json_string, json_parser_json_string_s *json_object, uint8_t is_initial, uint8_t is_final);
48void json_parser_json_string_put_array_int(json_parser_json_string_s *json_string, uint16_t val, uint8_t is_initial, uint8_t is_final);
49json_parser_json_object_s *json_parser_parse(char *json_string, uint16_t json_string_len);
53
54#endif
55
void json_parser_free_json_string(json_parser_json_string_s *json_string)
Frees a json string instance.
Definition: json_parser.c:294
void json_parser_json_string_put_str_pair(json_parser_json_string_s *json_string, char *key, char *val, uint8_t is_final, uint8_t is_initial)
Puts a JSON key/(string)value pair into a provided json string object;.
Definition: json_parser.c:89
void json_parser_json_string_nest(json_parser_json_string_s *json_string, char *key, json_parser_json_string_s *nested_json_string, uint8_t is_initial, uint8_t is_final)
Nests a child JSON string into a parent JSON string.
Definition: json_parser.c:121
void json_parser_json_string_put_array_int(json_parser_json_string_s *json_string, uint16_t val, uint8_t is_initial, uint8_t is_final)
Nests a child JSON string into a parent JSON array.
Definition: json_parser.c:177
void json_parser_json_string_put_array_object(json_parser_json_string_s *json_string, json_parser_json_string_s *json_object, uint8_t is_initial, uint8_t is_final)
Nests a child JSON string into a parent JSON array.
Definition: json_parser.c:150
void json_parser_json_string_put_int_pair(json_parser_json_string_s *json_string, char *key, uint16_t val, uint8_t is_initial, uint8_t is_final)
Puts a JSON key/(integer)value pair into a provided json string object;.
Definition: json_parser.c:56
void json_parser_free_json_object(json_parser_json_object_s *json_object)
Frees a parsed json object.
Definition: json_parser.c:263
json_parser_json_string_s * json_parser_json_string_new(void)
Creates and initialises a new json string instance.
Definition: json_parser.c:282
json_parser_json_object_s * json_parser_parse(char *json_string, uint16_t json_string_len)
Retrieves key/value pairs from a JSON encoded string.
Definition: json_parser.c:207
JSON Objects structure object.
Definition: json_parser.h:30
json_parser_json_param_s * params
Definition: json_parser.h:31
JSON parameter structure object.
Definition: json_parser.h:22
JSON String structure object.
Definition: json_parser.h:38