【发布时间】:2017-07-06 14:44:59
【问题描述】:
我有一个 json,看起来像
{
"children": [
{
"name": "apple",
"path": "hutchison",
"state": 16,
"url": "https://go.gl/",
"id": "ZXNrb0luZGlh",
"properties": [
{
"id": "type",
"name": "type",
"propertyType": "string",
"value": "COMPANY"
},
{
"id": "folderify",
"name": "folderify",
"propertyType": "boolean",
"value": "true"
},
{
"id": "name",
"name": "name",
"propertyType": "string",
"value": "yum"
}
],
"content": [],
"createdBy": "00ui3tqahuu6bwMhU0i6",
"creationDate": 1497348318103,
"modificationDate": 1499082955407,
"modifiedBy": "00ui3tqahuu6bwMhU0i6"
},
{
"name": "test",
"path": "test",
"state": 13,
"url": "https://ODE/v0/test",
"id": "YW5ib3Rlc3Q=",
"properties": [
{
"id": "string",
"name": "string",
"propertyType": "string",
"value": "string"
}
],
"content": [],
"createdBy": "00u33355JQXgmzqO90i5",
"creationDate": 1498463285568,
"modificationDate": 1498463356176,
"modifiedBy": "00u33355JQXgmzqO90i5"
},
{
"name": "KE",
"path": "KE",
"state": 4,
"url": "https://full.com/NODE/v0/DEKE",
"id": "REVLRQ==",
"properties": [
{
"id": "type",
"name": "type",
"propertyType": "string",
"value": "COMPANY"
},
{
"id": "folderify",
"name": "folderify",
"propertyType": "boolean",
"value": "true"
},
{
"id": "name",
"name": "name",
"propertyType": "string",
"value": "KE"
}
],
"content": [],
"createdBy": "00uy9bswhaVnUggF00i6",
"creationDate": 1498805345347,
"modificationDate": 1498805346371,
"modifiedBy": "00uy9bswhaVnUggF00i6"
}
]
,
"name": "",
"path": "",
"state": 27,
"url": "https://go.gl/ODE/v0",
"id": "ROOT",
"properties": [],
"content": [],
"createdBy": "INITIAL",
"creationDate": 1497261853581,
"modificationDate": 1498805345347,
"modifiedBy": "00uy9bswhaVnUggF00i6"
}
我当然希望使用 boost 库(也欢迎 cpp 中的任何其他方法)遍历每个键值对,以便稍后将它们保存在相关容器中。
【问题讨论】:
-
然后呢?你试过什么吗?请发布您的代码以及您遇到的问题。我们不能只为您编写代码!
-
我想要两片饼干和一块饼干,但我附近没有肯德基。