Function
judo_parse
Build an in-memory tree.
Parameters 🔗
source | in | JSON text encoded as UTF-8. |
length | in | Number of code units in |
root | out | The root of the JSON tree. |
error | out | Error details if an error occurs. |
user_data | in | User pointer to pass through to |
memfunc | in | Memory allocator callback. |
Return Value 🔗
JUDO_SUCCESS | If |
JUDO_BAD_SYNTAX | If |
JUDO_ILLEGAL_BYTE_SEQUENCE | If |
JUDO_INVALID_OPERATION | If |
JUDO_MAXIMUM_NESTING | If |
JUDO_OUT_OF_MEMORY | If dynamic memory allocation fails. |
JUDO_MALFUNCTION | If there is a defect in the implementation. |
Discussion 🔗
The judo_parse function parses string
as JSON, constructs an in-memory tree structure from it, and assigns the root of the tree to root
. If an error occurs, then error
will be populated with description and location information.
The string
must be UTF-8 encoded and its length specified by length
in code units. If length
is negative, then string
is interpreted as being null terminated.
The memfunc
function must implement a memory allocator as described in judo_memfunc. The user_data
pointer is passed to memfunc
as-is.