JsonParserInterface Class Reference

#include <parser_json.h>

Public Member Functions

MAXON_METHOD Result< void > Write (const DataDictionary &jsonObject, String &jsonString, Bool niceFormatting)
 
MAXON_METHOD Result< void > Read (const String &jsonString, JSONPARSERFLAGS flags, const ValueReceiver< const DataDictionary & > &jsonObjects)
 
MAXON_METHOD Result< void > Read (UrlOrInputStream &&nameOrStream, JSONPARSERFLAGS flags, const StringDecodingRef &stringDecoding, const ValueReceiver< const DataDictionary & > &jsonObjects)
 

Static Public Member Functions

static MAXON_METHOD Interface * Alloc (MAXON_SOURCE_LOCATION_DECLARATION)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (JsonParserInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.jsonparser")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( JsonParserInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.jsonparser"   
)
private

◆ Alloc()

static MAXON_METHOD Interface* Alloc ( MAXON_SOURCE_LOCATION_DECLARATION  )
static
Parameters
[in]allocLocationSource location.

◆ Write()

MAXON_METHOD Result<void> Write ( const DataDictionary &  jsonObject,
String jsonString,
Bool  niceFormatting 
)

ConvertToJSON converts a data dictionary into a JSON string.

Parameters
[in]jsonObjectDataDictionary to convert.
[out]jsonStringResult string.
[in]niceFormattingTrue to have nict formatting with idents and new lines. False to get compact format (smaller filesize).
Returns
OK on success.

◆ Read() [1/2]

MAXON_METHOD Result<void> Read ( const String jsonString,
JSONPARSERFLAGS  flags,
const ValueReceiver< const DataDictionary & > &  jsonObjects 
)

ConvertFromJSON parses a json string into DataDictionary representation.

Parameters
[in]jsonStringJSON formated string to precess.
[in]flagsSee JSONPARSERFLAGS.
[in]jsonObjectsValueReceiver which receives all processed DataDictionaries.
Returns
OK on success. If successful it's guaranteed that at least one DataDictionary was found.

◆ Read() [2/2]

MAXON_METHOD Result<void> Read ( UrlOrInputStream &&  nameOrStream,
JSONPARSERFLAGS  flags,
const StringDecodingRef &  stringDecoding,
const ValueReceiver< const DataDictionary & > &  jsonObjects 
)

ConvertFromJSON parses a json stream or url into DataDictionary representation.

Parameters
[in]nameOrStreamJSON formated input stream or file url.
[in]flagsSee JSONPARSERFLAGS.
[in]jsonObjectsValueReceiver which receives all processed DataDictionaries.
Returns
OK on success. If successful it's guaranteed that at least one DataDictionary was found.