你好,我是入门级iOS开发人员,我想从这个Json代码中获取所有payLoad值。
Json代码是
:(
{
request = {
fromId = sam;
payLoad = helllooooffffff;
timeZone = IST;
toId = john;
};
},
{
request = {
fromId = sam;
payLoad = yes;
timeZone = IST;
toId = john;
};
},
{
request = {
fromId = sam;
payLoad = Yesssss;
timeZone = IST;
toId = john;
};
},)
有人帮助我
感谢
答案 0 :(得分:1)
假设您已将JSON检索到已检索的JSON,您可以像这样浏览字典:
for (NSMutableDictionary *nmd in retrievedJSON) {
NSMutableDictionary *request = [nmd objectForKey:@"request"];
NSLog(@"%@", [request objectForKey:@"payLoad"]);
}
在这个特定的例子中,我将浏览所有词典和NSLogging payLoad。您可以将此值分配给变量,对象等。
您可以使用类似的语法访问其他键。