Parsing JSON array and object in Android

前端 未结 6 1911
渐次进展
渐次进展 2021-01-07 15:22

This is what the JSON looks like:

[{
    \"pmid\": \"2\",
    \"name\": \" MANAGEMENT\",
    \"result\": \"1\",
    \"properties\": [
        {
            \         


        
6条回答
  •  有刺的猬
    2021-01-07 16:00

    use this

    try {
                JSONArray array0 = new JSONArray(Sample);
                JSONObject object0 = array0.getJSONObject(0);
                JSONArray array1 = object0.getJSONArray("properties");
                JSONObject object1 = array1.getJSONObject(0);
                String name = object1.getString("prop_name");
    
    
            } catch (JSONException e) {
                e.printStackTrace();
            }
    

提交回复
热议问题