read json
来源:互联网 发布:ios10软件闪退 编辑:程序博客网 时间:2024/05/29 17:47
// parse json from string.
using rapidjson::Document;
Document doc;
doc.Parse<0>(stringFromStream.c_str());
if (doc.HasParseError()) {
rapidjson::ParseErrorCode code = doc.GetParseError();
psln(code);
return;
}
// use values in parse result.
using rapidjson::Value;
Value & v = doc["dictVersion"];
if (v.IsInt()) {
psln(v.GetInt());
}
Value & contents = doc["content"];
if (contents.IsArray()) {
for (size_t i = 0; i < contents.Size(); ++i) {
Value & v = contents[i];
assert(v.IsObject());
if (v.HasMember("key") && v["key"].IsString()) {
psln(v["key"].GetString());
}
if (v.HasMember("value") && v["value"].IsString()) {
psln(v["value"].GetString());
}
}
}
using rapidjson::Document;
Document doc;
doc.Parse<0>(stringFromStream.c_str());
if (doc.HasParseError()) {
rapidjson::ParseErrorCode code = doc.GetParseError();
psln(code);
return;
}
// use values in parse result.
using rapidjson::Value;
Value & v = doc["dictVersion"];
if (v.IsInt()) {
psln(v.GetInt());
}
Value & contents = doc["content"];
if (contents.IsArray()) {
for (size_t i = 0; i < contents.Size(); ++i) {
Value & v = contents[i];
assert(v.IsObject());
if (v.HasMember("key") && v["key"].IsString()) {
psln(v["key"].GetString());
}
if (v.HasMember("value") && v["value"].IsString()) {
psln(v["value"].GetString());
}
}
}
阅读全文
0 0
- read json
- Read JSON File--jQuery
- Android read write json
- JSON.simple example – Read and write JSON Read
- sparkR read json file error
- unicode' object has no attribute 'read' json
- could not read json : unrecognized field "$$hashkey"
- JSON.simple example – Read and write JSON
- read()
- read ()
- read
- read
- read
- read()
- read
- read
- read
- read()
- ### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column \'name\' at row 1
- ext column renderer使用
- API翻译:glGenBuffers
- Java encodeURI
- java web之转义字符
- read json
- av_frame_xxx系列
- 服务器开发学习笔记
- tensorflow学习:预测样本的分布(一)
- Java 之md5加密
- shiro权限控制之粗细粒度的区别(转)
- Spring MVC静态资源报404错误
- HDU
- Spring+Spring MVC+Shiro+Mybatis框架集成