如何解析Json android下面

时间:2016-07-11 08:56:13

标签: android json

我在Json下面有Parse。我是通过多个if else循环来实现的。是否有任何标准的方法来解析这种json格式。 请提供任何帮助..

JSON: 

{
"Info": {
        "DeviceInfo": {
            "Version": "NA",
            "IMEI"   : "NA",
            "IMSI"   : "NA",
            "Manufacture" : "NA",
            "Network"     : "NA",
            "Root"        : "NA",
            "Storage"     : "NA"
        },
        "SettingInfo": {
            "Brightness": "NA",
            "FlightMode": "NA"
        },
        "AdvanceInfo": {
            "PictureCount": "NA",
            "VideoCount": "NA",
            "CallIn": "NA",
            "CallOut":"NA"
        },
        "MemoryInfo": {
            "RAM": "NA",
            "ReadSpeedInternal": "NA",
            "WriteSpeedInternal": "NA"
        }
    }
}

2 个答案:

答案 0 :(得分:0)

让Gson或Jackson图书馆为您辛勤工作,不需要自己进行解析,

GSON:https://github.com/google/gson/blob/master/UserGuide.md 杰克逊:https://github.com/FasterXML/jackson

有关详细信息,请参阅https://dzone.com/articles/be-lazy-productive-android

答案 1 :(得分:0)

像这样:

-e enable interpretation of backslash escapes 

以下是更多信息+示例:

How to parse JSON in Android

http://www.tutorialspoint.com/android/android_json_parser.htm