比如我的数据类型是这样的:
{"data":[
{
"created_at":"Sat May 14 22:05:52 +0800 2022",
"id": "4769148843065803",
"disable_reply": 0,
"comments":[
{
"created_at":"Sat May 14 22:09:52 +0800 2022",
"id": "4769148843065805",
"disable_reply": 1,
"comments":[]
},
{
"created_at":"Sat May 14 22:20:52 +0800 2022",
"id": "4769148843065807",
"disable_reply": 4,
"comments":[]
}
]
},
{
"省略":"省略"
}
]
}
我尝试建一个映射类去接收:
import java.util.List;
@Data
public class Comment {
//评论时间
private String created_at;
// 省略部分字段.......
// 该条评论下的评论
private List<Comment> comments;
}
我的接收处理:
List<Comment> cts= data.getArray("data").toList(Comment.class);
目前无法接收,会报如下错误:

比如我的数据类型是这样的:
{"data":[ { "created_at":"Sat May 14 22:05:52 +0800 2022", "id": "4769148843065803", "disable_reply": 0, "comments":[ { "created_at":"Sat May 14 22:09:52 +0800 2022", "id": "4769148843065805", "disable_reply": 1, "comments":[] }, { "created_at":"Sat May 14 22:20:52 +0800 2022", "id": "4769148843065807", "disable_reply": 4, "comments":[] } ] }, { "省略":"省略" } ] }我尝试建一个映射类去接收:
我的接收处理:
目前无法接收,会报如下错误:
