I have a JSON string as an NSString object in iOS. I want to parse this and pull out the given parameters in the JSON string. Is there a efficient way to parse this or is the only way to search for substrings etc.?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The way to do it with iOS 5 is to use the
NSJSONSerializationclass. You will want to first convert your string to an NSData object, and call the class methodJSONObjectWithDataNote that
JSONObjectWithDatawill return either an NSDictionary or an NSArray, depending whether your JSON string represents an a dictionary or an array.