Everything messed up in my head. enum, NSObject, custom interface and so on…
All I need is to declare data type in Objective C for representing this JSON collection:
{
"firstName": "John",
"lastName" : "Smith",
"age" : 25,
"address" :
{
"streetAddress": "21 2nd Street",
"city" : "New York",
"state" : "NY",
"postalCode" : "10021"
},
"phoneNumber":
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}
This is example from wikipedia JSON article. So I need an explanation about how can I put all this data in collection (or custom type or something else, I don’t know).
For example I need 1000 instances of “phonebook” collection to store and change information about 1000 people. I need to know how can I do it.
example for firstname and address:
more here: http://caydenliew.com/2011/11/json-in-ios-5/