我有来自restapi和wnat的响应来访问注释中的回复,我有来自quicktype.io的模型,但不知道如何迭代和获取数据。
"data": {
"_id": "61ee65fd92a48c7b10779f24",
"topicName": "Test Topic",
"description": "<p>Test Discussion</p>",
"createdByName": "Admin",
"comments": [
{
"_id": "622740a70fdfbb1bdd00232b",
"comment": "post commnet test",
"commentedById": "611cb5ecaf1a1bbc858d4d13",
"user": [
{
"title": "Mr",
"firstName": "John",
"lastName": "Cart",
"userID": "USER1000022",
"_id": "611cb5ecaf1a1bbc858d4d13"
}
],
"replies": []
},
{
"_id": "620d05382773643acd49177b",
"comment": "test message",
"commentedById": "611cb5ecaf1a1bbc858d4d13",
"commentedByName": "Mr. John Cart",
"user": [
{
"title": "Mr",
"firstName": "John",
"lastName": "Cart",
"userID": "USER1000022",
"_id": "611cb5ecaf1a1bbc858d4d13"
}
],
"replies": [
{
"_id": "6227351b0fdfbb099800232a",
"comment": "test msg",
"commentedById": "611cb5ecaf1a1bbc858d4d13",
"commentedByName": "Mr, john cart",
"replyUser": [
{
"title": "Mr",
"firstName": "John",
"lastName": "cart",
"userID": "USER1000022",
"_id": "611cb5ecaf1a1bbc858d4d13"
}
]
}
],
},任何帮助或文件/建议/指南都是有帮助的
谢谢
发布于 2022-03-09 06:16:54
var object= json.decode(response.body)对象变量必须采用重复语法。
print(object["data"]["comments"][index]["replies"]https://stackoverflow.com/questions/71405009
复制相似问题