Faster JsonCpp alternative that allows copying/mutability of Json objects? Faster JsonCpp alternative that allows copying/mutability of Json objects? json json

Faster JsonCpp alternative that allows copying/mutability of Json objects?


After searching for some time the "documentation" I finally found a good way to copy JSON objects with rapidjson wich is very convenient:

rapidjson::Document doc; // This is the base document that you got from parsing etcrapidjson::Value& v = doc["newMember"]; // newMember = 100assert(v.GetInt() == 100);rapidjson::Document copy;doc.Accept(copy); // The accept meachnism is the same as used in parsing, but for copyingassert(copy["newMember"].GetInt() == doc["newMember"].GetInt())

The explicit copying has one advantage: It forces you to think clearly about when you are using references or potentially unnecessary copies.