gpt4 book ai didi

ios - 休息套件 : Map relationship from JSON parentId

转载 作者:行者123 更新时间:2023-11-29 02:56:58 25 4
gpt4 key购买 nike

我如何使用 Restkit 映射以下 JSON?以下 JSON 包含一个 ParentId (ParentMenu) 和 MenuId,我想使用它们来映射来 self 的实体 (Product) -->> (SubMenus) 的核心数据关系。

Items": [
{
"PriceExclVat": 39.6,
"MenuId": 1100,
"Count": 1,
"ParentMenu": null
},
{
"PriceExclVat": 0,
"MenuId": 1104,
"Count": 1,
"ParentMenu": 1100
},
{
"PriceExclVat": 0,
"MenuId": 1106,
"Count": 1,
"ParentMenu": 1100
},
{
"PriceExclVat": 0,
"MenuId": 1102,
"Count": 1,
"ParentMenu": 1100
}
]

最佳答案

您需要为映射添加连接。

[mapping addConnectionForRelationship:@"parent" connectedBy:@{ @"ParentMenu" : @"MenuId" }];

@"parent" 替换为您的 parent 关系的名称。

关于ios - 休息套件 : Map relationship from JSON parentId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23763287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com