rapidjson 使用例子

前端之家收集整理的这篇文章主要介绍了rapidjson 使用例子前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
		Document document;
		Document::AllocatorType& allocator = document.GetAllocator();
		Value root(kObjectType);
		Value child(kObjectType);
		child.AddMember("a","1",allocator);
		child.AddMember("b","2",allocator);

		root.AddMember("name","哥伦布啊",allocator);
		root.AddMember("gold",1234,allocator);
		root.AddMember("children",child,allocator);

		StringBuffer buffer;
		Writer<StringBuffer> writer(buffer);
		root.Accept(writer);
		std::string reststring = buffer.GetString();
		std::cout << reststring << std::endl;
		/*
		{
			"name":"哥伦布啊","gold":1234,"children":{
							"a":"1","b":"2"
						}
		}
		*/
原文链接:https://www.f2er.com/json/289346.html

猜你在找的Json相关文章