Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Serialization and deserialization of JSON-formatted text (C++).

License

agafon0ff/JsonObject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JsonObject

Class implements serialization and deserialization of JSON-formatted text.

Serialization json-object to text:

JsonObject jsonObject;
jsonObject.setValue("bool", true);
jsonObject.setValue("number", 123.4567);
jsonObject.setValue("text", "Hello world!");
cout << jsonObject.stringify(JsonObject::MODE_COMPACT) << endl;
// {"bool":true,"number":123.4567000000,"text":"Hello world!"}

Deserialization text to json-object:

string data = "{\"bool\": false, \"num\":123.457, \"name\":\"Jane\"}";
JsonObject jsonObject;
jsonObject.parse(data);
string name = jsonObject.value("name").toString();
double num = jsonObject.value("num").toNumber();
cout << "name: " << name << ", num: " << num << endl;
// name: Jane, num: 123.457

About

Serialization and deserialization of JSON-formatted text (C++).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published