fwCtrlUtils  8.5.0
CtrlJsonSerialize library reference

Functions

string fwJsonSerialize (const shared_ptr< type >|const type &obj, const dyn_string &noSerialize=makeDynString(), bool compact=true)
 
int fwJsonDeserialize (const string &json, shared_ptr< type >|type &obj)
 

Detailed Description

CtrlJsonSerialize module provides the tools to serialize and deserialize CTRL++ objects into/from their JSON representation.

Please refer to the CtrlJsonSerialize Programmer Manual section for a comprehensive programmer's guide.

Function Documentation

string fwJsonSerialize ( const shared_ptr< type >|const type &  obj,
const dyn_string &  noSerialize = makeDynString(),
bool  compact = true 
)

Serialize given object, pointer or variable into string containing its JSON equivalent

Parameters
[in]objObject, pointer or variable to be serialized
[in]noSerializeList of object properties to be excluded from serialization (by default empty) - note: not implemented
[in]compactFlag indicating whether produced string should contain JSON in compated (true - default) indented (false) format
Returns
String containing JSON representation of given value
Empty string in case of errors
int fwJsonDeserialize ( const string &  json,
shared_ptr< type >|type &  obj 
)

Deserialize string with JSON encoded data into given object, pointer or variable

Parameters
[in]jsonString containing JSON encoded data
[out]objObject, pointer or variable to which deserialized data is assigned
Returns
0 when deserialization successfull
1 when deserialization finished with warnings (to be retrieved with getLastError())
-1 when an error occured during deserialization and it can't be finished