在AFNetworking的JSONRequestOperationWithRequest:success:failure:方法中,什么类型的对象是JSON响应?

时间:2021-10-14 21:25:32

It gives you a variable called JSON of type id, but how do I manipulate this? Is it a string? Do I have to serialize it first? How exactly do I interact with it?

它为您提供了一个名为JSON的类型为id的变量,但我该如何操作呢?它是一个字符串?我必须先将其序列化吗?我该如何与它互动?

2 个解决方案

#1


1  

It is returned in the form of dictionary, you just need to extract the value based on the key. Example :

它以字典的形式返回,您只需要根据键提取值。示例:

[JSON valueForKey:@"key"];

[JSON valueForKey:@“key”];

#2


0  

You can get more than the basics here

您可以在这里获得更多基础知识

Fantastic course, there's very good code about json handling in the photo mania app.

太棒了,在照片*应用程序中有关于json处理的非常好的代码。

#1


1  

It is returned in the form of dictionary, you just need to extract the value based on the key. Example :

它以字典的形式返回,您只需要根据键提取值。示例:

[JSON valueForKey:@"key"];

[JSON valueForKey:@“key”];

#2


0  

You can get more than the basics here

您可以在这里获得更多基础知识

Fantastic course, there's very good code about json handling in the photo mania app.

太棒了,在照片*应用程序中有关于json处理的非常好的代码。