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. |
| udata | in | User pointer to pass through to |
| memfunc | in | Memory allocator callback. |
Return Value 🔗
| JUDO_RESULT_SUCCESS | If |
| JUDO_RESULT_BAD_SYNTAX | If |
| JUDO_RESULT_ILLEGAL_BYTE_SEQUENCE | If |
| JUDO_RESULT_INVALID_OPERATION | If |
| JUDO_RESULT_MAXIMUM_NESTING | If |
| JUDO_RESULT_OUT_OF_MEMORY | If dynamic memory allocation fails. |
| JUDO_RESULT_MALFUNCTION | If there is a defect in the implementation. |
Discussion 🔗
The judo_parse function parses source 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 source must be UTF-8 encoded and its length specified by length in code units. If length is negative, then source is interpreted as being null terminated.
The memfunc function must implement a memory allocator as described in judo_memfunc. The udata pointer is passed to memfunc as-is.