Parse JSON to cofigure android application

后端 未结 1 533
猫巷女王i
猫巷女王i 2021-01-17 06:33

In my android app, I have to use JSON from server to make specific adjustment in the app. I\'m trying to achive is to read this json and store all the values into local vari

相关标签:
1条回答
  • 2021-01-17 06:58

    Current json string format is :

    [  //<<<< JSONArray
    
        {   //<<<< JSONObject
           // other items here...
        }
    
    ]
    

    this Json string content JSONArray as root element instead of JSONObject. you will need to convert it first JSONArray then extract JSONObject from it :

    JSONArray jsonObject = jParser.getJSONFromUrl(url);
    

    also change getJSONFromUrl method return type to JSONArray

    0 讨论(0)
提交回复
热议问题