58 #pragma warning(disable : 4820)
85 typedef struct das_json_str_s {
93 typedef struct das_json_str_ex_s {
95 struct das_json_str_s string;
108 typedef struct das_json_num_s {
116 typedef struct das_json_dict_el_s {
122 struct das_json_dict_el_s *
next;
126 typedef struct das_json_dict_s {
134 typedef struct das_json_ary_el_s {
138 struct das_json_ary_el_s *
next;
142 typedef struct das_json_ary_s {
152 typedef struct das_json_obj_s {
168 typedef struct das_json_val_ex_s {
186 das_jparse_flags_default = 0,
219 das_jparse_flags_deprecated = 0x40,
358 const void *src,
size_t src_size,
size_t flags_bitset,
359 void *(*alloc_func_ptr)(
void *,
size_t),
void *user_data,
446 const char *newline,
size_t *out_size);
455 #if defined(_MSC_VER)
459 #endif // _das_json_h_
A JSON number value.
Definition: json.h:108
allow multi line string values
Definition: json.h:240
allow numbers to be hexadecimal
Definition: json.h:228
catch-all error for everything else that exploded (real bad chi!)
Definition: json.h:307
struct das_json_dict_el_s * start
a linked list of the elements in the object
Definition: json.h:128
a JSON value (extended)
Definition: json.h:168
allow numbers like .0123 or 123.
Definition: json.h:234
size_t string_size
the size (in bytes) of the string
Definition: json.h:89
const char * DasJdo_string(const DasJdo *pThis)
Get a string value from a JSON DOM element.
size_t number_size
the size (in bytes) of the number
Definition: json.h:112
const das_json_ary_el * DasJdo_aryFirst(const DasJdo *pThis)
Get the first array element from a JSON array.
A JSON string value (extended)
Definition: json.h:93
allow JSON5 to be parsed.
Definition: json.h:255
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.
void * DasJdo_writeMinified(const DasJdo *pThis, size_t *out_size)
Write out a minified JSON utf-8 string.
const das_json_dict_el * DasJdo_dictFirst(const DasJdo *pThis)
Get the first dictionary element from a JSON dictionary.
das_json_parse_flags_e
Flag useed by dasj_parse() and dasj_parse_ex() to alter parsing behavior.
Definition: json.h:185
string was malformed!
Definition: json.h:296
size_t row_no
the row number for the value in the JSON input, in bytes
Definition: json.h:104
size_t row_no
the row number for the value in the JSON input, in bytes
Definition: json.h:179
das_json_type_e
The various types JSON values can be.
Definition: json.h:74
size_t line_no
the line number for the value in the JSON input
Definition: json.h:101
allow a global unbracketed object.
Definition: json.h:201
size_t error_row_no
the row number for the error, in bytes
Definition: json.h:324
allow strings to be 'single quoted'
Definition: json.h:225
the JSON input had unexpected trailing characters that weren't part of the JSON value ...
Definition: json.h:304
a JSON dictionary payload
Definition: json.h:126
size_t error_offset
the character offset for the error in the JSON input
Definition: json.h:318
DasJdo value
the JSON value this extends.
Definition: json.h:170
allow numbers like +123 to be parsed
Definition: json.h:231
struct das_json_str_s * name
the name of this element
Definition: json.h:118
size_t line_no
the line number for the value in the JSON input
Definition: json.h:176
record location information for each value.
Definition: json.h:222
const char * string
utf-8 string
Definition: json.h:87
allow trailing commas in objects and arrays.
Definition: json.h:191
struct das_json_obj_s * value
the value of this element
Definition: json.h:120
error report from json_parse_ex()
Definition: json.h:311
reached end of buffer before object/array was complete!
Definition: json.h:293
const DasJdo * DasJdo_get(const DasJdo *pThis, const char *sRelPath)
Given a DOM path retrieve a JSON element.
allow that objects don't have to have comma separators between key/value pairs.
Definition: json.h:211
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.
no error occurred (huzzah!)
Definition: json.h:270
size_t length
the number of elements in the array
Definition: json.h:146
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:315
A JSON string value.
Definition: json.h:85
invalid number format!
Definition: json.h:287
allow simplified JSON to be parsed.
Definition: json.h:245
an element of a JSON array
Definition: json.h:134
allow Infinity, -Infinity, NaN, -NaN
Definition: json.h:237
size_t length
the number of elements in the object
Definition: json.h:130
allow objects to use '=' instead of ':' between key/value pairs.
Definition: json.h:206
invalid value!
Definition: json.h:290
allow unquoted keys for objects.
Definition: json.h:196
size_t error_line_no
the line number for the error in the JSON input
Definition: json.h:321
size_t offset
the character offset for the value in the JSON input
Definition: json.h:173
An element of a JSON dictionary.
Definition: json.h:116
const char * number
ASCII string containing representation of the number.
Definition: json.h:110
size_t type
must be one of das_json_type_e.
Definition: json.h:161
invalid escaped sequence in string!
Definition: json.h:284
expected either a comma or a closing '}' or ']' to close an object or array!
Definition: json.h:275
void * DasJdo_writePretty(const DasJdo *pThis, const char *indent, const char *newline, size_t *out_size)
Write out a pretty JSON utf-8 string.
a call to malloc, or a user provider allocator, failed
Definition: json.h:299
JSON Dom Element.
Definition: json.h:152
a JSON array value
Definition: json.h:142
colon separating name/value pair was missing!
Definition: json.h:278
size_t offset
the character offset for the value in the JSON input
Definition: json.h:98
struct das_json_ary_el_s * start
a linked list of the elements in the array
Definition: json.h:144
struct das_json_obj_s * value
the value of this element
Definition: json.h:136
void * value
a pointer to either a das_json_str, das_json_num, das_json_dict, or das_json_ary. ...
Definition: json.h:157
DasJdo * das_json_parse(const void *src, size_t src_size)
Parse a JSON text file with default options and without detailed error reporting. ...
expected string to begin with '"'!
Definition: json.h:281
struct das_json_ary_el_s * next
the next array element (can be NULL if the last element in the array)
Definition: json.h:138
allow c-style comments (// or /* *\/) to be ignored in the input JSON file.
Definition: json.h:216
struct das_json_dict_el_s * next
the next object element (can be NULL if the last element in the object)
Definition: json.h:122
das_jparse_error_e
JSON parsing error codes.
Definition: json.h:268