Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This question already has an answer here:

I have a webpage with the code in JSON:

[
    {"url":"event.com","name":"Event name","event":"Event"},
    {"url":"event.com","name":"Event name 2","event":"Event"},
    {"url":"event.com","name":"Event name 3","event":"Event 3sw"}
]

I need this data to be stored in an NSMutableArray, like this, with a loop:

[eventsArray addObject:[NSArray arrayWithObjects:url,name,event, nil]];
[eventsArray addObject:[NSArray arrayWithObjects:url,name,event, nil]];
[eventsArray addObject:[NSArray arrayWithObjects:url,name,event, nil]];

How It's possible, maybe with AFNetworking?

share|improve this question
 
Check here stackoverflow.com/questions/9252100/… –  Ozan Deniz Jul 17 at 14:18
 
@Daniel Campos - Accept any answer to increase your accepting rate. –  The Tiger Jul 20 at 5:13

marked as duplicate by The Tiger, Josh Caswell, mishik, devnull, Aschratt Jul 19 at 7:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

There are many different JSON Parsers. Apple provides one called NSJSONSerialization

Check here for a very similar question:

How to use NSJSONSerialization

Or the docs:

http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html

share|improve this answer
 
That doesn't answer his question. He wants the data in Foundation objects structured differently than the JSON. –  Aaron Brager Jul 17 at 17:07
 
How I can do it using AFNetworking library ? –  Daniel Campos Jul 17 at 18:52
 
looks like they have it built in. Follow the examples here:cocoadocs.org/docsets/AFNetworking/1.3.1/Classes/… Here is an example of them getting a json object github.com/AFNetworking/AFNetworking/wiki/… –  utahwithak Jul 17 at 19:29

While you can of course create your own JSON parser, I don't think it would be a good idea. Here is a github repository for an Objective-C JSON parser

https://github.com/stig/json-framework/

Read the documentation and you should be good to go

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.