Gson解析json數據 親自測試可用

{
    HosPitalInventoryInfo: {
        HosPitalInventorylist: [
            {
                "疫苗名稱": "23價肺炎球菌多糖疫苗",
                "批號": "K003747",
                "規格": "0.5毫升/人份/瓶,盒1瓶",
                "生產廠家": "成都生物製品研究全部限責任公司"
            },
            {
                "疫苗名稱": "23價肺炎球菌多糖疫苗(默沙東)(2)",
                "批號": "k003747",
                "規格": "0.5ml/支",
                "生產廠家": "美國默沙東"
            },
            {
                "疫苗名稱": "ACYW135羣腦膜炎球菌多糖疫苗",
                "批號": "201302009",
                "規格": "0.5ml盒1瓶",
                "生產廠家": "浙江天元生物藥業有限公司"
            },
            {
                "疫苗名稱": "A羣C羣腦膜炎球菌多糖疫苗",
                "批號": "201310108/2",
                "規格": "0.5ml/瓶,盒5瓶",
                "生產廠家": "蘭州生物製品研究全部限責任公司"
            }
            ]
    }
}  json 數據格式java

 

//解析

JSONObject  dataJson=new JSONObject(str);
  JSONObject  response=dataJson.getJSONObject("HosPitalInventoryInfo");
  JSONArray data=response.getJSONArray("HosPitalInventorylist");
  JSONObject info=data.getJSONObject(0);
  String province=info.getString("疫苗名稱");
相關文章
相關標籤/搜索