【发布时间】:2018-05-28 05:57:03
【问题描述】:
我有一个json array 像这样-:
"custom_attributes": [
{
"attribute_code": "description",
"value": "Darkly sophisticated aromas take you into Siberia"},
{
"attribute_code": "color",
"value": "6"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "brand",
"value": "Molton Brown "
},
{
"attribute_code": "supplier",
"value": "Molton Brown "
},
{
"attribute_code": "features",
"value": "Twilight "
}
]
我想通过iterator解析它。我的键是attribute_code 和值。
请帮我解析一下。
【问题讨论】:
-
请展示你的作品。 JSON 无效
-
@IntelliJAmiya JSON 有效。这是一个具有相同键的数组。我想得到,假设是“描述”。我不想像 getJsonObject(0) 那样写。相反,我希望迭代器找到 attr 代码“描述”及其具体值
-
只写一个for循环。这正是迭代的含义。
-
离开我已经通过HashMap完成了
标签: android arrays json iterator