Json

Inherited: None

Description

This class implements Json parser with Variant based DOM structure input/output. It allows to serialize and deserialize object structures represented in Variant DOM structure.

Example:

VariantMap dictionary;
dictionary["bool"]  = true;
dictionary["str"]   = "string";
dictionary["int"]   = 1;
dictionary["float"] = 2.0f;

string data = Json::save(dictionary); // Serializing dictionary to string
....
VariantMap result = Json::load(data).toMap(); // Resotoring it back

Public Methods

None

Static Methods

Variant

load (const std::string & data)

std::string

save (const Variant & data, int32_t tab = -1)

Methods Description

Variant Json::load (std::string & data)

Returns deserialized string data as Variant based DOM structure.


std::string Json::save (Variant & data, int32_t tab = -1)

Returns serialized data as string. Argument tab is used as JSON *tab*ulation formatting offset (-1 for one line JSON)