Rapidjson: add external sub-document to document Rapidjson: add external sub-document to document json json

Rapidjson: add external sub-document to document


This turned out to be more simple than I thought. From GitHub (issue 436):

The easiest solution to avoid the copy is to reuse the allocator of the outer document:

rapidjson::Document jsonSubDocument(&jsonDocument.GetAllocator());wheel_.ToJson(jsonSubDocument);jsonDocument.AddMember("wheel_", jsonSubDocument, jsonDocument.GetAllocator());