1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Document d(kObjectType); Document::AllocatorType& allocator = d.GetAllocator();
Value tags(kArrayType); tags.PushBack("json", allocator); tags.PushBack("parser", allocator); tags.PushBack("c++", allocator); d.AddMember("tags", tags, allocator);
Value author(kObjectType); author.AddMember("name", "Tencent", allocator); author.AddMember("url", "https://github.com/Tencent/rapidjson", allocator); d.AddMember("author", author, allocator);
Value contributors(kArrayType); Value contributor1(kObjectType); contributor1.AddMember("name", "Milo Yip", allocator); contributor1.AddMember("commits", 1000, allocator);
Value contributor2(kObjectType); contributor2.AddMember("name", "其他贡献者", allocator); contributor2.AddMember("commits", 500, allocator);
contributors.PushBack(contributor1, allocator); contributors.PushBack(contributor2, allocator); d.AddMember("contributors", contributors, allocator);
|