- Select ref document -

SDK Json Parser API documentation

version 1.2.162

<dmsdk/dlib/json.h>

API for platform independent parsing of json files

Functions

Free

Free(document)

Deallocates a previously created dmJson::Document

Parameters

document

dmJson::Document* The document

document

dmJson::Document* The document

Parse

Parse(buffer, buffer_length, document)

Parses an (utf-8) string into a dmJson::Document The document must later be freed with dmJson::Free()

Parameters

buffer

const char* The input data (Utf-8)

buffer_length

uint32_t The size of the json buffer (in bytes)

document

dmJson::Document* The output document

buffer

const char* The input data (Utf-8)

buffer_length

uint32_t The size of the json buffer (in bytes)

document

dmJson::Document* The output document

Returns

dmJson::RESULT_OK

on success

dmJson::RESULT_OK

on success

Parse

Parse(buffer, document)

Parses a null terminated (utf-8) string into a dmJson::Document The document must later be freed with dmJson::Free()

Parameters

buffer

const char* The input data (Utf-8)

document

dmJson::Document* The output document

buffer

const char* The input data (Utf-8)

document

dmJson::Document* The output document

Returns

dmJson::RESULT_OK

on success

dmJson::RESULT_OK

on success

Structs

dmJson::Document

Holds a full json document

Members

m_Nodes

dmJson::Node Array of nodes. First node is root

m_NodeCount

int Total number of nodes

m_Json

char* Json-data (unescaped)

m_UserData

void* User-data

m_Nodes

dmJson::Node Array of nodes. First node is root

m_NodeCount

int Total number of nodes

m_Json

char* Json-data (unescaped)

m_UserData

void* User-data

dmJson::Node

Nodes are in depth-first order with sibling links for simplified traversal.

NOTE: Siblings were added to support a read-only lua-view of json-data. It's currently not used and could potentially be removed for increased performance.

Members

m_Type

dmJson::Type Node type

m_Start

int Start index inclusive into document json-data

m_End

int End index exclusive into document json-data

m_Size

int Size. Only applicable for arrays and objects

m_Sibling

int Sibling index. -1 if no sibling

m_Type

dmJson::Type Node type

m_Start

int Start index inclusive into document json-data

m_End

int End index exclusive into document json-data

m_Size

int Size. Only applicable for arrays and objects

m_Sibling

int Sibling index. -1 if no sibling

Enumerations

dmJson::Result

Result enumeration.

Members

dmJson::RESULT_OK
dmJson::RESULT_SYNTAX_ERROR
dmJson::RESULT_INCOMPLETE
dmJson::RESULT_UNKNOWN
dmJson::RESULT_OK
dmJson::RESULT_SYNTAX_ERROR
dmJson::RESULT_INCOMPLETE
dmJson::RESULT_UNKNOWN

dmJson::Type

Token type enumeration.

Members

dmJson::TYPE_PRIMITIVE

Number or boolean

dmJson::TYPE_OBJECT

Json object

dmJson::TYPE_ARRAY

Json array

dmJson::TYPE_STRING

String

dmJson::TYPE_PRIMITIVE

Number or boolean

dmJson::TYPE_OBJECT

Json object

dmJson::TYPE_ARRAY

Json array

dmJson::TYPE_STRING

String