A JSONObject text must begin with '{' error

后端 未结 4 2345
独厮守ぢ
独厮守ぢ 2021-02-19 00:54

I have this JSON coming from one of our REST service:

[
    \"{\\\"category_name\\\":[\\\"Industry Components\\\"],\\\"categoryId\\\":[1]}\",
    \"{\\\"category         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 01:38

    instead

    JSONObject jsonObject = new JSONObject(jsonStr);
    

    use

    JSONArray jsonArray = new JSONArray(jsonStr);
    

    and may be read about Gson is a nice library for parsing and work with json

提交回复
热议问题