I have this json string by getting a response from using singleton client(RestKit).
[
{
"created_at":"Tue Apr 24 19:25:14 +0000 2012",
"id":132456,
},
{
"created_at":"Tue Apr 24 19:25:14 +0000 2012",
"id":13456,
},
]
I got this result by
NSDictionary *results = [[response bodyAsString] JSONValue];
which results to this
(
{
"created_at" = "Tue Apr 24 19:25:14 +0000 2012";
"id"=132456;
}
{
"created_at" = "Tue Apr 24 19:25:14 +0000 2012";
"id"=132456;
}
)
as NSDictionary.
As you can see there is no key available for me to get. If so, I would have done a code like this NSMutableArray *block = [results objectForKey:@"key"];
. I tried to put and empty string for objectForKey but it doesn't work and gave me an error "objectForKey".
Question: How can I parse every block to put it inside an array without a key?
Please help! Thanks!
This actually is an Array of 2 Dictionaries. Change your code:
to
Then you can use a For-In to get all the Dictionaries from that array if you need to. The Key appears to be the id attribute.
So for the first one in the array: