I want to create an NSDictionary like this type:
我想创建这样的NSDictionary:
"zones":
{
{
"zoneId": "1",
"locations":
{
{
"locId": "1",
"locZoneId": "1",
"locLatitude": "33.68506785633641",
"locLongitude": "72.97488212585449"
},
{
"locId": “2”,
"locZoneId": "1",
"locLatitude": "33.68506785633641",
"locLongitude": "72.97488212585449"
},
{
"locId": “3”,
"locZoneId": "1",
"locLatitude": "33.68506785633641",
"locLongitude": "72.97488212585449"
},
}
}
}
But I don't know how to create.
但我不知道如何去创造。
1 个解决方案
#1
22
You should use a combination of arrays and dictionaries.
您应该使用数组和字典的组合。
Dictionaries are initialized like this:
字典是这样初始化的:
NSDictionary *dict = @{ key : value, key2 : value2};
Arrays are initialized like this:
数组初始化如下:
NSArray *array = @[Object1, Object2]
#1
22
You should use a combination of arrays and dictionaries.
您应该使用数组和字典的组合。
Dictionaries are initialized like this:
字典是这样初始化的:
NSDictionary *dict = @{ key : value, key2 : value2};
Arrays are initialized like this:
数组初始化如下:
NSArray *array = @[Object1, Object2]