【发布时间】:2020-12-09 09:16:46
【问题描述】:
尝试使用我的参数从 JSON 中查找唯一数据集。
我有 JSON“userDetails”:
{
"userDetails": [
{
"name": "Sabine",
"imageUrl" :"https://randomuser.me/api/portraits/men/82.jpg",
"content": [
{
"type": "video",
"url": "https://storage.googleapis.com/coverr-main/mp4/Travaho.mp4"
},
{
"type": "image",
"url": "https://picsum.photos/640/1136/?image=281"
}
]
},
{"name": "Keila Maney",
"imageUrl" :"https://randomuser.me/api/portraits/women/81.jpg",
"content": [
{
"type": "image",
"url": "https://picsum.photos/640/1136/?image=273"
},
{
"type": "video",
"url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"
}
]
}
]
}
我知道我的用户是 Keila Maney(我的代码中有用户属性)并且需要将该参数发送到 JSON,并且只接收返回 Keila Maney strong> 属性(就是imageUrl, content(type, url))然后解析。
有没有标准的 JSON 搜索方法?
提前致谢!
【问题讨论】:
-
need to send that parameter to JSON是什么意思? -
没有标准。这取决于后端
-
这意味着在JSON中我有很多记录,我需要用我的参数过滤掉它们(在我的例子中参数是“name”="Keila Maney")
标签: ios json swift parsing search