在JSON中,
{ }代表一个对象(键/值对)并[ ]代表一个数组。从您提供的示例来看,这是服务器的期望值:
最高对象 :具有两个键的字典:
TypeProperties和
ImageUrls。
TypeProperties 和 ImageUrls
:每个数组都是一个包含一个或多个带有两个键的对象的数组:
Key和
Value。每个键应具有其各自的值。
为了符合服务器的期望,您需要一个与此类似的结构(请注意,这只是一个简单的示例,直接在此处编写,但应指出正确的方向):
NSDictionary *object = [NSDictionary dictionaryWithObjectsAndKeys: @"prop 0", @"Key", @"blah 0", @"Value", nil];NSArray *typeProperties = [NSArray arrayWithObjects: object, // Add as many similar objects as you want nil];NSArray *imageUrls = [NSArray arrayWithObjects:object, // Add as many similar objects as you wantnil];
然后,在您的
proxyForJson方法中,您可以使用:
- (NSDictionary*) proxyForJson{ return [NSDictionary dictionaryWithObjectsAndKeys: typeProperties, @"TypeProperties", imageUrls, @"ImageUrls", nil];}


