Reputation: 42173
I need to build an NSDictionary
that I can then parse with NSJSONSerialization
in order to get a nice JSON
formatted string.
The final output of my JSON needs to be something like:
"Viewport":{
"BottomRight":{
"Latitude":1.26743233E+15,
"Longitude":1.26743233E+15
},
"TopLeft":{
"Latitude":1.26743233E+15,
"Longitude":1.26743233E+15
}
}
I figured it might be easiest to use NSDictionary
literals, but how would I create multi-level nested dictionaries doing it this way?
Also, I will need to be setting the lat and long values when creating the dictionary.
Upvotes: 3
Views: 457
Reputation: 119041
You can arbitrarily nest liberals:
@{@"Viewport":@{
@"BottomRight":@{
@"Latitude":@(1267...),
@"Longitude":@(126...)
},
...
Upvotes: 4