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 数据格式

 

//解析

JSONObject  dataJson=new JSONObject(str);
  JSONObject  response=dataJson.getJSONObject("HosPitalInventoryInfo");
  JSONArray data=response.getJSONArray("HosPitalInventorylist");
  JSONObject info=data.getJSONObject(0);
  String province=info.getString("疫苗名称");

 

 

 

你可能感兴趣的:(Gson解析json数据 亲自测试可用)