json - 带有 Rest API 的 IOS Swift 的正确 Json 结构
问题描述
从需要存储多次出现的信息的 IOS swift 设备获取的正确 JSON 结构是什么。我必须存储一个人的多个地址,其中一个是他居住的当前地址。如果 IOS 应用程序是用 swift 编写的,我应该如何接受当前的占用。我使用“iscurrent”来检查当前和以前的占用情况。另请建议在 get API 中发送此 json 信息的正确方法是什么。我在下面使用post和get。在获取发送当前占用率始终位于顶部。
{
"items": [
{
"address": "string",
"city": "string",
"suburb": "string",
"postcode": "string",
"moveindate": "string",
"landlordname": "string",
"landlordemail": "string",
"iscurrent": 0,
"occid": 0
}
]
}
有人建议我保存后发送如下。
{
"items":
"iscurrent" = {
"address": "string",
"city": "string",
"suburb": "string",
"postcode": "string",
"moveindate": "string",
"landlordname": "string",
"landlordemail": "string",
"occid": 1
},
"previous" = [{
"address": "string",
"city": "string",
"suburb": "string",
"postcode": "string",
"moveindate": "string",
"landlordname": "string",
"landlordemail": "string",
"occid": 2
},{
"address": "string",
"city": "string",
"suburb": "string",
"postcode": "string",
"moveindate": "string",
"landlordname": "string",
"landlordemail": "string",
"occid": 3
},
]
}
解决方案
推荐阅读
- c++ - 使用具有多个目标的 CodeCoverage.cmake 进行代码覆盖率分析
- c# - 序列化 C# 对象并保留属性名称
- postgresql - 如何将tomcat容器中的应用程序连接到同一网络中创建的postgres容器?
- c - merge_sort 在某些情况下有效且无效(输入数字)
- javascript - d3 使 g 在同一行继续
- css - WP PageNavi 不接受 CSS 文件
- uwp - 如何签署 .appxupload 文件
- ios - UICollectionview 单元格中的下拉列表
- php - php中的浮动数据比较行为?
- javascript - 为什么我不能在派生类中创建构造函数?