118 #ifndef JSON_PARSER_H
119 #define JSON_PARSER_H
128 #if !defined(_WIN32) || !defined(_MSC_VER)
129 #include <inttypes.h>
132 typedef UINT8 uint8_t;
134 typedef UINT16 uint16_t;
135 typedef INT16 int16_t;
136 typedef ULONG32 uint32_t;
137 typedef LONG32 int32_t;
138 typedef UINT64 uint64_t;
139 typedef INT64 int64_t;
143 #ifdef __STDC_VERSION__
144 # if __STDC_VERSION__ >= 199901L
151 #define __func__ "unknown_function"
158 #if __STDC_VERSION__ >- 199901L
162 #ifdef __bool_true_false_are_defined
165 #define boolean _Bool
171 #define false (bool)0
178 #define FALSE (bool)0
865 #define invalid_empty 0
866 #define JSON_object 1
870 #define JSON_boolean 5
871 #define JSON_integer 6
872 #define JSON_double 7
873 #define JSON_float_str 8
874 #define JSON_string 9
959 #define ENVIRONMENT_VAR_DEBUGGING "JSON_PARSER_DEBUG"
963 #if defined( INITIALIZE_DEBUGGING_FLAG )
1139 JSON_value_types *json_data_type,
1140 element_search object_search_function,
1141 element_compare object_compare_function,
1142 element_search array_search_function,
1143 element_compare array_compare_function,
1144 const boolean keep_exponent);
1201 char **object_error,
1202 unsigned long int *line_number,
1203 const boolean suppress_warnings);
1254 JSON_value_types json_data_type,
1255 char **json_text_buffer);
1722 const char *member_name,
1723 const boolean partial_name,
1724 const char *string_value,
1725 const boolean partial_value);
1793 const boolean partial_name,
1794 const json_integer_t minimum_value,
1795 const json_integer_t maximum_value,
1796 const boolean value_range);
1864 const boolean partial_name,
1865 const json_double_t minimum_value,
1866 const json_double_t maximum_value,
1867 const boolean value_range);
1912 const char *member_name,
1913 const boolean partial_name,
1914 const JSON_value_types value_type);
1979 list_object *json_data,
1980 const char *member_name,
1981 const boolean partial_name,
1982 const char *string_value,
1983 const boolean partial_value);
2030 const boolean strict_path,
2031 const boolean suppress_errors);
2089 const char *member_name,
2090 const char *string_value);
2128 const char *member_name,
2129 const json_integer_t integer_number,
2130 const json_double_t double_number);
2168 const char *member_name,
2169 const char *float_str);
2196 const char *member_name,
2197 const boolean boolean_value);
2223 const char *member_name);
2257 const char *member_name,
2258 list_object *new_list,
2259 const JSON_value_types list_type);
2281 const char *string_value);
2317 const json_integer_t *integer_number,
2318 const json_double_t *double_number,
2319 const unsigned int item_count);
2355 const char *float_str);
2378 const boolean boolean_value);
2430 list_object *new_list,
2431 const JSON_value_types list_type);
2533 unsigned int count);
2543 unsigned int count);
2553 const char *list_name,
2554 const int list_type,
2555 const boolean dig_down);
JSON_value_types value_type
Definition: json-parser.h:881
boolean boolean_value
Definition: json-parser.h:888
list_object * json_find_members_value_type(list_object *json_data, const char *member_name, const boolean partial_name, const JSON_value_types value_type)
Using the provided search criteria, search the JSON data and locate all object members in the list hi...
void display_parsed_json_object(list_object *json_object, const char *list_name, const int list_type, const boolean dig_down)
This function will either display all the elements in a single list_object, or will walk an entire hi...
element_compare object_compare_function
Definition: json-parser.h:952
char * member_name
Definition: json-parser.h:882
list_object * json_parse_data_block(char *json_data_block, JSON_value_types *json_data_type, element_search object_search_function, element_compare object_compare_function, element_search array_search_function, element_compare array_compare_function, const boolean keep_exponent)
Call the JSON Parser and return a hierarchical list_object containing the parsed contents of the JSON...
char * string
Definition: json-parser.h:885
int json_list_object_member_add_string(list_object *list_to_add, const char *member_name, const char *string_value)
Add a new Member with a string value to a JSON Object, defined by the list_object provided...
int default_compare_function_array_values(const void *element, const void *key)
This the default compare function applied to all JSON Array lists, unless an alternative is provided ...
char * member_name
Definition: json-parser.h:909
boolean default_search_function_array_double_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for a match of elem...
int json_list_object_member_add_list(list_object *list_to_add, const char *member_name, list_object *new_list, const JSON_value_types list_type)
Add a new Member with a JSON Array or JSON Object value to an existing JSON Object, defined by the list_object provided.
char * json_generate_path_from_links(json_path_t path[], unsigned int count)
Create a character array describing a set of links in a JSON Data block for reporting or printing pur...
boolean default_search_function_precise_array_double_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for a match of elem...
boolean default_search_function_member_name(const void *element, const void *key)
The following is the list of available search and compare functions that are built into JSON Parser...
Definition: json-parser.h:880
boolean default_search_function_array_values(const void *element, const void *key)
This the default search function applied to all JSON Array list_objects, unless an alternative is pro...
boolean default_search_function_partial_member_name(const void *element, const void *key)
This search function searches the elements of a specified JSON Object List looking for a match of obj...
boolean default_search_function_array_partial_string_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for a match of elem...
boolean default_search_function_array_string_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for an exact match ...
int json_list_object_array_value_add_null(list_object *list_to_add)
Add a new null value to a JSON Array, defined by the list_object provided.
int default_compare_function_array_double_values(const void *element, const void *key)
This compare function evaluates the elements of a specified JSON Array List It can be used on both JS...
int json_list_object_array_value_add_list(list_object *list_to_add, list_object *new_list, const JSON_value_types list_type)
Add a new data value to an existing JSON Array, that has as a value type of either a JSON Array or JS...
list_object * json_owner_object
Definition: json-parser.h:941
*typedef unsigned int JSON_value_types
Definition: json-parser.h:864
long double json_double_t
Definition: json-parser.h:877
element_search object_search_function
Definition: json-parser.h:951
int json_list_object_member_add_float_str(list_object *list_to_add, const char *member_name, const char *float_str)
Add a new Member with a exponential number represented as a string value (instead of a binary floatin...
JSON_value_types json_report_list_object_type(list_object *list)
Given an unknown list_object, provide the JSON value type this list_object represents.
int json_list_object_array_value_add_string(list_object *list_to_add, const char *string_value)
Add a new String Value to a JSON Array, defined by the list_object provided.
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 ...
void json_print_path_from_links(json_path_t path[], unsigned int count)
Display to stdout text describing a set of links in a JSON data block.
int json_list_object_member_add_boolean(list_object *list_to_add, const char *member_name, const boolean boolean_value)
Add a new Member with a boolean value to a JSON Object, defined by the list_object provided...
json_integer_t integer
Definition: json-parser.h:886
list_object * json_find_members_value_integer(list_object *json_data, char *member_name, const boolean partial_name, const json_integer_t minimum_value, const json_integer_t maximum_value, const boolean value_range)
Using the provided search criteria, search the JSON data and locate all object members in the list hi...
boolean json_parser_debugging
unsigned int array_index
Definition: json-parser.h:908
int json_list_object_array_value_add_float_str(list_object *list_to_add, const char *float_str)
Add a new value with a exponential number represented as a string, (instead of a binary floating numb...
list_object * json_find_members_value_double(list_object *json_data, char *member_name, const boolean partial_name, const json_double_t minimum_value, const json_double_t maximum_value, const boolean value_range)
Using the provided search criteria, search the JSON data and locate all object members in the list hi...
JSON_value_types value_type
Definition: json-parser.h:944
boolean json_valid_data_block(const char *json_object, char **object_error, unsigned long int *line_number, const boolean suppress_warnings)
Call the JSON syntax validator and return a boolean value based on either successful or failed valida...
int default_compare_function_array_number_values(const void *element, const void *key)
JSON_value_types value_type
Definition: json-parser.h:906
list_object * json_path_to_list_object(list_object *json_data, const char *path)
Convert a JSON dotted notation path to a list_object for that path.
int json_list_object_member_add_null(list_object *list_to_add, const char *member_name)
Add a new Member with a null value to a JSON Object, defined by the list_object provided.
int json_list_object_array_value_add_boolean(list_object *list_to_add, const boolean boolean_value)
Add a new Boolean Value to a JSON Array, defined by the list_object provided.
boolean default_search_function_array_integer_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for a match of elem...
int json_find_member_value(json_member_list_t *result, list_object *json_data, const char *member_name, const boolean partial_name, const char *string_value, const boolean partial_value)
Using the provided search criteria, search the JSON data and locate the first JSON object member in t...
int64_t json_integer_t
Definition: json-parser.h:876
int json_list_object_array_value_add_number(list_object *list_to_add, const json_integer_t *integer_number, const json_double_t *double_number, const unsigned int item_count)
Add a new Number Value to a JSON Array, defined by the list_object provided.
#define FALSE
Definition: json-parser.h:178
int json_list_object_member_add_number(list_object *list_to_add, const char *member_name, const json_integer_t integer_number, const json_double_t double_number)
Add a new Member with a number value to a JSON Object, defined by the list_object provided...
Definition: json-parser.h:950
element_compare array_compare_function
Definition: json-parser.h:954
list_object * object
Definition: json-parser.h:884
json_double_t double_number
Definition: json-parser.h:887
list_object * json_find_members_value_string(list_object *json_data, const char *member_name, const boolean partial_name, const char *string_value, const boolean partial_value)
=================================================================
list_object * json_create_new_list_object(const JSON_value_types list_type, const functions_globals_t *functions)
Create a new list_object to be used to represent either a JSON Object or a JSON Array.
boolean free_string_ptr
Definition: json-parser.h:890
element_reference * reference
Definition: json-parser.h:942
int default_compare_function_member_names(const void *element, const void *key)
This the default compare function applied to all JSON Object lists, unless an alternative is provided...
unsigned int path_segments
Definition: json-parser.h:945
int json_generate_data_block(list_object *json_data, JSON_value_types json_data_type, char **json_text_buffer)
Using a JSON Object data tree, represented by a hierarchical D-List list_object structure, create a textural version of that JSON data presented and return a character array with that JSON data in it, in strict JSON Grammar format.
int default_compare_function_array_string_values(const void *element, const void *key)
JSON Array List value specific compare functions.
int default_compare_function_array_integer_values(const void *element, const void *key)
This compare function evaluates the elements of a specified JSON Array List It can be used on both JS...
element_search array_search_function
Definition: json-parser.h:953
json_element_t * json_member
Definition: json-parser.h:943
Definition: json-parser.h:940
boolean default_search_function_sloppy_array_double_value(const void *element, const void *key)
This search function searches the elements of a specified JSON Array List looking for a match of elem...
Definition: json-parser.h:905
json_member_list_t * json_parse_dotted_path(const char *dotted_path)
Create a set of links describing a JSON data path, by parsing a character array with JSON dotted noti...