json获取列表记录

依赖

<dependency>
    <groupId>com.alibabagroupId>
    <artifactId>fastjsonartifactId>
    <version>1.2.83version>
dependency>

导包

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

示例

String str = "{'aa':['11','22','33']}";
JSONObject jsonObject = JSONObject.parseObject(str);
JSONArray jsonArray = jsonObject.getJSONArray("aa");
for (int i = 0; i < jsonArray.size(); i++){
    System.out.println(jsonArray.get(i));
}

你可能感兴趣的:(json,java)