gpt4 book ai didi

Iphone:如何在 Objective C 中创建 json

转载 作者:行者123 更新时间:2023-12-03 19:58:37 29 4
gpt4 key购买 nike

我正在开发 iPhone 应用程序。我必须从 Iphone 以以下格式将 json 字符串返回到 Web 服务。我正在使用 Objective-C

{
"InspectionDetails":
[
{"isCompleted":"Y","QMSStepId":"1A","QMSEmpId":"6","QMSInspectionID":"1","InspectedDate":"07/28/11 09:52:34", "isNewRoom":"1","RoomInspID":"1","QMSRoomId":"1","QMSScoreId":"4"},
{"isCompleted":"Y","QMSStepId":"1B","QMSEmpId":"4","QMSInspectionID":"1","InspectedDate":"07/28/11 09:52:34", "isNewRoom":"1","RoomInspID":"1","QMSRoomId":"1","QMSScoreId":"3"}
],
"InspectionComments":
[
{"QMSPredefinedCommentId":"1","customText":"Test1 Comment","RoomInspID":"1"},
{"QMSPredefinedCommentId":"2","customText":"Test2 Comment","RoomInspID":"1"}
],
"Tools":
[
{"Facility_Code" : "1","HddId" : "AIPH01"}
]
}

任何人都可以帮我如何形成上述回复吗?

我有一个想法,我可以通过使用 NSArray 和 NSDictonary 来做到这一点,但我希望所有数组都在一个字典中。谁能指导一下吗?

谢谢,什拉达

最佳答案

最简单的方法是使用类似 SBJSON 的内容。然后你就可以这样做

NSString *jsonString = [myDictionary JSONRepresentation];

关于Iphone:如何在 Objective C 中创建 json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6992353/

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