java如何将如图所示的json中的list解析出来,并将每一个元素放入arraylist中?
{"current_time":"2022-11-22T12:22:39.089Z","timelist":["2022-08-31T19:48:58.290Z","2022-11-20T02:20:49.684Z","2022-01-20T02:06:37.952Z","2022-01-09T15:07:15.109Z","2022-02-28T12:48:49.242Z","2022-10-21T00:11:00.437Z","2022-02-10T09:52:45.520Z","2022-07-28T23:44:04.718Z","2022-02-02T01:48:27.967Z","2022-07-14T20:31:48.570Z","2022-05-20T14:20:13.222Z","2022-03-30T13:18:09.986Z"]}
我这种用jsonobject的写法对吗?
private void parseJSONWithJSONObject(String jsonData){
try{
JSONObject jsonObject = new JSONObject(jsonData);
JSONArray jsonArray=jsonObject.getJSONArray("timelist");
for(int i=0;i<jsonArray.length();i++){
JSONObject jsonObject1=jsonArray.getJSONObject(i);
String time_n=jsonObject1.getString("");
Log.d("timedata",time_n);
}
}catch (Exception e){
e.printStackTrace();
}
}