59 #pragma warning(disable : 4820)
86 typedef struct das_json_str_s {
94 typedef struct das_json_str_ex_s {
96 struct das_json_str_s string;
109 typedef struct das_json_num_s {
117 typedef struct das_json_dict_el_s {
123 struct das_json_dict_el_s *
next;
127 typedef struct das_json_dict_s {
135 typedef struct das_json_ary_el_s {
139 struct das_json_ary_el_s *
next;
143 typedef struct das_json_ary_s {
153 typedef struct das_json_obj_s {
169 typedef struct das_json_val_ex_s {
187 das_jparse_flags_default = 0,
220 das_jparse_flags_deprecated = 0x40,
359 const void *src,
size_t src_size,
size_t flags_bitset,
360 void *(*alloc_func_ptr)(
void *,
size_t),
void *user_data,
447 const char *newline,
size_t *out_size);
456 #if defined(_MSC_VER)
Minimal definitions for das2 utilities that can safely be run without calling das_init().
DAS_API void * DasJdo_writeMinified(const DasJdo *pThis, size_t *out_size)
Write out a minified JSON utf-8 string.
DAS_API const char * DasJdo_string(const DasJdo *pThis)
Get a string value from a JSON DOM element.
DAS_API DasJdo * das_json_parse_ex(const void *src, size_t src_size, size_t flags_bitset, void *(*alloc_func_ptr)(void *, size_t), void *user_data, struct das_json_parse_result_s *result)
Parse a JSON text file, returning a pointer to the root of the JSON structure.
DAS_API const DasJdo * DasJdo_get(const DasJdo *pThis, const char *sRelPath)
Given a DOM path retrieve a JSON element.
DAS_API DasJdo * das_json_parse(const void *src, size_t src_size)
Parse a JSON text file with default options and without detailed error reporting.
DAS_API const das_json_dict_el * DasJdo_dictFirst(const DasJdo *pThis)
Get the first dictionary element from a JSON dictionary.
DAS_API const char * json_parse_error_info(const struct das_json_parse_result_s *pRes, char *sTmp, size_t uLen)
Provide error string describing a parsing error result.
DAS_API const das_json_ary_el * DasJdo_aryFirst(const DasJdo *pThis)
Get the first array element from a JSON array.
DAS_API void * DasJdo_writePretty(const DasJdo *pThis, const char *indent, const char *newline, size_t *out_size)
Write out a pretty JSON utf-8 string.
das_json_parse_flags_e
Flag useed by dasj_parse() and dasj_parse_ex() to alter parsing behavior.
Definition: json.h:186
das_jparse_error_e
JSON parsing error codes.
Definition: json.h:269
das_json_type_e
The various types JSON values can be.
Definition: json.h:75
@ das_jparse_flags_allow_trailing_comma
allow trailing commas in objects and arrays.
Definition: json.h:192
@ das_jparse_flags_allow_equals_in_object
allow objects to use '=' instead of ':' between key/value pairs.
Definition: json.h:207
@ das_jparse_flags_allow_multi_line_strings
allow multi line string values
Definition: json.h:241
@ das_jparse_flags_allow_c_style_comments
allow c-style comments (// or /* *\/) to be ignored in the input JSON file.
Definition: json.h:217
@ das_jparse_flags_allow_json5
allow JSON5 to be parsed.
Definition: json.h:256
@ das_jparse_flags_allow_no_commas
allow that objects don't have to have comma separators between key/value pairs.
Definition: json.h:212
@ das_jparse_flags_allow_inf_and_nan
allow Infinity, -Infinity, NaN, -NaN
Definition: json.h:238
@ das_jparse_flags_allow_single_quoted_strings
allow strings to be 'single quoted'
Definition: json.h:226
@ das_jparse_flags_allow_unquoted_keys
allow unquoted keys for objects.
Definition: json.h:197
@ das_jparse_flags_allow_global_object
allow a global unbracketed object.
Definition: json.h:202
@ das_jparse_flags_allow_simplified_json
allow simplified JSON to be parsed.
Definition: json.h:246
@ das_jparse_flags_allow_leading_plus_sign
allow numbers like +123 to be parsed
Definition: json.h:232
@ das_jparse_flags_allow_leading_or_trailing_decimal_point
allow numbers like .0123 or 123.
Definition: json.h:235
@ das_jparse_flags_allow_location_information
record location information for each value.
Definition: json.h:223
@ das_jparse_flags_allow_hexadecimal_numbers
allow numbers to be hexadecimal
Definition: json.h:229
@ das_jparse_error_expected_comma_or_closing_bracket
expected either a comma or a closing '}' or ']' to close an object or array!
Definition: json.h:276
@ das_jparse_error_invalid_string
string was malformed!
Definition: json.h:297
@ das_jparse_error_unexpected_trailing_characters
the JSON input had unexpected trailing characters that weren't part of the JSON value
Definition: json.h:305
@ das_jparse_error_invalid_number_format
invalid number format!
Definition: json.h:288
@ das_jparse_error_expected_opening_quote
expected string to begin with '"'!
Definition: json.h:282
@ das_jparse_error_unknown
catch-all error for everything else that exploded (real bad chi!)
Definition: json.h:308
@ das_jparse_error_invalid_string_escape_sequence
invalid escaped sequence in string!
Definition: json.h:285
@ das_jparse_error_premature_end_of_buffer
reached end of buffer before object/array was complete!
Definition: json.h:294
@ das_jparse_error_allocator_failed
a call to malloc, or a user provider allocator, failed
Definition: json.h:300
@ das_jparse_error_invalid_value
invalid value!
Definition: json.h:291
@ das_jparse_error_expected_colon
colon separating name/value pair was missing!
Definition: json.h:279
@ das_jparse_error_none
no error occurred (huzzah!)
Definition: json.h:271
JSON Dom Element.
Definition: json.h:153
void * value
a pointer to either a das_json_str, das_json_num, das_json_dict, or das_json_ary.
Definition: json.h:158
size_t type
must be one of das_json_type_e.
Definition: json.h:162
an element of a JSON array
Definition: json.h:135
struct das_json_ary_el_s * next
the next array element (can be NULL if the last element in the array)
Definition: json.h:139
struct das_json_obj_s * value
the value of this element
Definition: json.h:137
a JSON array value
Definition: json.h:143
struct das_json_ary_el_s * start
a linked list of the elements in the array
Definition: json.h:145
size_t length
the number of elements in the array
Definition: json.h:147
An element of a JSON dictionary.
Definition: json.h:117
struct das_json_str_s * name
the name of this element
Definition: json.h:119
struct das_json_dict_el_s * next
the next object element (can be NULL if the last element in the object)
Definition: json.h:123
struct das_json_obj_s * value
the value of this element
Definition: json.h:121
a JSON dictionary payload
Definition: json.h:127
struct das_json_dict_el_s * start
a linked list of the elements in the object
Definition: json.h:129
size_t length
the number of elements in the object
Definition: json.h:131
A JSON number value.
Definition: json.h:109
size_t number_size
the size (in bytes) of the number
Definition: json.h:113
const char * number
ASCII string containing representation of the number.
Definition: json.h:111
error report from json_parse_ex()
Definition: json.h:312
size_t error_line_no
the line number for the error in the JSON input
Definition: json.h:322
size_t error_offset
the character offset for the error in the JSON input
Definition: json.h:319
size_t error_row_no
the row number for the error, in bytes
Definition: json.h:325
size_t error
the error code (one of json_parse_error_e), use dasj_parse_error_info() To convert the value to an er...
Definition: json.h:316
A JSON string value (extended)
Definition: json.h:94
size_t line_no
the line number for the value in the JSON input
Definition: json.h:102
size_t row_no
the row number for the value in the JSON input, in bytes
Definition: json.h:105
size_t offset
the character offset for the value in the JSON input
Definition: json.h:99
A JSON string value.
Definition: json.h:86
const char * string
utf-8 string
Definition: json.h:88
a JSON value (extended)
Definition: json.h:169
size_t line_no
the line number for the value in the JSON input
Definition: json.h:177
DasJdo value
the JSON value this extends.
Definition: json.h:171
size_t row_no
the row number for the value in the JSON input, in bytes
Definition: json.h:180
size_t offset
the character offset for the value in the JSON input
Definition: json.h:174