JSON Parser  1.0
json-parser.h File Reference
#include <inttypes.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  json_element_t
 
struct  json_path_t
 
struct  json_member_list_t
 
struct  functions_globals_t
 

Macros

#define false   (bool)0
 =================================================

License Statement

More...
 
#define true   (bool)1
 
#define TRUE   (bool)1
 
#define FALSE   (bool)0
 
#define invalid_empty   0
 
#define JSON_object   1
 
#define JSON_array   2
 
#define JSON_value   3 /* NOT a valid types for list elements */
 
#define JSON_null   4
 
#define JSON_boolean   5
 
#define JSON_integer   6
 
#define JSON_double   7
 
#define JSON_float_str   8
 
#define JSON_string   9
 
#define ENVIRONMENT_VAR_DEBUGGING   "JSON_PARSER_DEBUG"
 

Typedefs

typedef int64_t json_integer_t
 
typedef long double json_double_t
 

Functions

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 data block requested. More...
 
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 validation. More...
 
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. More...
 
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. More...
 
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 object name to the partial key value string. More...
 
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 provided by the caller of parse_json_data_block(), or a different search function is provided for a specific list_object using the D-List function list_set_search_function(). More...
 
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 of element string value to the key value string. More...
 
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 element string value to the partial key value string. More...
 
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 element integer value to the key value integer. More...
 
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 element number (non-integer) value to the key value number. More...
 
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 element number (non-integer) value to the key value number. More...
 
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 element number (non-integer) value to the key value number. More...
 
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 by the caller of parse_json_data_block() More...
 
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 by the caller of parse_json_data_block() More...
 
int default_compare_function_array_number_values (const void *element, const void *key)
 
int default_compare_function_array_string_values (const void *element, const void *key)
 JSON Array List value specific compare functions. More...
 
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 JSON Object lists and Array lists. More...
 
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 JSON Object lists and Array lists. More...
 
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)
 ================================================================= More...
 
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 hierarchy that match the criteria, returning them in a new list_object to the caller. More...
 
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 hierarchy that match the criteria, returning them in a new list_object to the caller. More...
 
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 hierarchy that match the criteria, returning them in a new list_object to the caller. More...
 
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 the list hierarchy that match the criteria, returning a pointer to it to the caller. More...
 
json_member_list_tjson_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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 floating number) to a JSON Object, defined by the list_object provided. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 number) to a JSON Object, defined by the list_object provided. More...
 
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. More...
 
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. More...
 
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 JSON Object, defined by the list_object provided. More...
 
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. More...
 
json_member_list_tjson_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 notion in it. More...
 
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 purposes. More...
 
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. More...
 
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 hierarchy of list_objects displaying the elements as it goes through them. More...
 

Variables

*typedef unsigned int JSON_value_types
 
boolean json_parser_debugging