Parsing json

assemble_json_parse

AJsonValue *assemble_json_parse(char *string, int write_protected, AJsonType number_type);

Description: parses a string of json and creates a tree structure of AJasonValues. If write_protected, the Parsing and the resulting tree will be significantly faster but not modifyable. "number_type" needs to be a A_JT_NUMBER_FLOAT, a A_JT_NUMBER_DOUBLE or a A_JT_NUMBER_DECIMAL, and will specify how parsed numbers are stored internaly. All numberd values can be read read/written using nmber get/set function disregarding of how it is stored internally.

Types:

Enum:

AJsonType

A_JT_BOOLEAN

=

0

A_JT_NUMBER

=

1

A_JT_STRING

=

2

A_JT_OBJECT

=

3

A_JT_ARRAY

=

4

A_JT_NULL

=

5

A_JT_MODULO

=

8

Description:

A_JT_FALSE

=

A_JT_BOOLEAN

+

A_JT_MODULO

*

0

A_JT_TRUE

=

A_JT_BOOLEAN

+

A_JT_MODULO

*

1

A_JT_NUMBER_FLOAT

=

A_JT_NUMBER

+

A_JT_MODULO

*

0

A_JT_NUMBER_DOUBLE

=

A_JT_NUMBER

+

A_JT_MODULO

*

1

A_JT_NUMBER_DECIMAL

=

A_JT_NUMBER

+

A_JT_MODULO

*

2

A_JT_MULTIPLE

=

-1

assemble_json_parse_single_pass

AJsonValue *assemble_json_parse_single_pass(char *string, uint string_length, int write_protected, AJsonType number_type);

Description: parses a string of json and creates a tree structure of AJasonValues. If write_protected, the Parsing and the resulting tree will be significantly faster but not modifyable. "number_type" needs to be a A_JT_NUMBER_FLOAT, a A_JT_NUMBER_DOUBLE or a A_JT_NUMBER_DECIMAL, and will specify how parsed numbers are stored internaly. All numberd values can be read read/written using number get/set function disregarding of how it is stored internally. This version of the parser forgoes any validation and will crash if the json string is in any way broken. The implementation will allocate lagest possible memory footprint, estimated from the "string_length" parameter, and will therfor be very memory wastefull.

Types:

Enum:

AJsonType

A_JT_BOOLEAN

=

0

A_JT_NUMBER

=

1

A_JT_STRING

=

2

A_JT_OBJECT

=

3

A_JT_ARRAY

=

4

A_JT_NULL

=

5

A_JT_MODULO

=

8

Description:

A_JT_FALSE

=

A_JT_BOOLEAN

+

A_JT_MODULO

*

0

A_JT_TRUE

=

A_JT_BOOLEAN

+

A_JT_MODULO

*

1

A_JT_NUMBER_FLOAT

=

A_JT_NUMBER

+

A_JT_MODULO

*

0

A_JT_NUMBER_DOUBLE

=

A_JT_NUMBER

+

A_JT_MODULO

*

1

A_JT_NUMBER_DECIMAL

=

A_JT_NUMBER

+

A_JT_MODULO

*

2

A_JT_MULTIPLE

=

-1

assemble_json_clone

AJsonValue *assemble_json_clone(AJsonValue *value);

Description: Closes a Value and all it children. The resulting structure is not write protected.

assemble_json_free

void assemble_json_free(AJsonValue *value);

Description: Free a Value. If the value tree is write protected only can be root can be freed.