JSON数组通过迭代器解析

时间:2017-12-14 07:51:19

标签: android arrays json iterator

我有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和值。

请帮我解析。

1 个答案:

答案 0 :(得分:1)

您的JSON无效。它应该以[从而删除用于json数组的键“custom_attributes”开始。