Questions tagged [nsjsonserialization]

NSJSONSerialization class is used to convert JSON to Foundation objects and Foundation objects to JSON

NSJSONSerialization class is used to convert JSON to Foundation objects and Foundation objects to JSON.

More information: NSJSONSerialization Class Reference

709 questions
0
votes
1 answer

String to JSON Array unrecognized selector error

I'm trying to parse some JSON to a NSArray but I'm getting the following error: [__NSCFDictionary length]: unrecognized selector sent to instance 0x6d7a160 The area of code that's throwing this error is: -…
Matthew Arkin
  • 4,460
  • 2
  • 27
  • 28
0
votes
1 answer

NSURLConnection Hangs under certain conditions

I'm posting to a RESTful webservice and receiving a response, this works great if I'm getting back only a few records however there is a threshold where didReceiveData: stops being called (6 records) and it just hangs. (does not matter what records,…
KDM
  • 197
  • 5
  • 18
0
votes
1 answer

iOS5: Unable to read value from JSON using NSJSONSerialization

I am trying to parse JSON data. The data is an Array with objects inside it. This is the JSON array I get from the URL: ["{content:Airfare}", "{content:Dues \/ Subscriptions}", "{content:Education \/…
user1342592
  • 49
  • 1
  • 12
0
votes
1 answer

NSJSONSerialization Issue

Hi I have this code. NSString *infoString = [NSString stringWithFormat:@"http://link.com/post.php?name=%@&street=%@&city=%@&state=%@&zip=%@&lat=%@&lon=%@", name, street, city, state, zip, str1, str2]; NSURL *infoUrl = [NSURL…
user1457381
0
votes
1 answer

Capturing PHP Response Through NSJSONSerialization

Hi I have this code here. NSString *name = [[NSString alloc] initWithFormat:[nameField text]]; NSString *street = [[NSString alloc] initWithFormat:[streetField text]]; NSString *city = [[NSString alloc] initWithFormat:[cityField…
user1457381
0
votes
1 answer

NSJSONSerialization not updating data

I am trying to parse JSON with iOS5's NSJSONSerialization. This code CORRECTLY parse the data I wanted for the first time, BUT THEN THE DATA JUST STAYED THE SAME. The JSON on the URL already changed, but the code kept giving me the first data it…
0
votes
4 answers

How to send JSON data over NSURLConnection

I have successfully created a method which connects to my web service and POSTS a string and receives a string response. However, I am now trying to POST a JSON dictionary created using NSJSONSerialization. However, Xcode is giving me an error. I…
Ben Thompson
  • 4,743
  • 7
  • 35
  • 52
0
votes
1 answer

How can I tell the NSStringEncoding from NSData?

I have NSData from +[NSJSONSerialization dataWithJSONObject:options:error:]. How is the data encoded?
0
votes
1 answer

JSON Errors + Objective C

I have found a few ways to parse JSON in Objective-C: SBJSON NSJSONSerialization Both of these methods work great, however my only problem is that when an error occurs, I would like more details than the error message. Specifically, I would like…
Kyle
  • 17,317
  • 32
  • 140
  • 246
-1
votes
1 answer

Decode JSON array inside a JSON dictionary without creating Boilerplate Types

The JSON: let jsonString = """ { "groups": [ { "id": "oruoiru", "testProp": "rhorir", "name": "* C-Level", "description": "C-Level" }, { "id": "seese", "testProp": "seses", …
Anton Unt
  • 1,835
  • 1
  • 21
  • 47
-1
votes
1 answer

Cannot iterate through array inside array of dictionaries

I'm having trouble parsing a response into workable objects in swift. Basically, this is the response I get (simplified data for viewing purposes) "[{\"CO2\":0,\"Places\":[{\"Name\":\"RT(Esc.…
kyrers
  • 489
  • 1
  • 6
  • 22
-1
votes
1 answer

What is the return type of JSONSerialization.jsonObject(with:options:) in Swift?

I made the json parser in swift language. But, many of people are using like below. let jsonParsed = JSONSerialization.jsonObject(with: data, options: []) guard let jsonDict = jsonParsed as? Dictionary else { return } ... Then,…
strawnut
  • 359
  • 5
  • 21
-1
votes
2 answers

Json deserialization with objective-c failing on copyright symbol

I'm primarily a c# developer but I have been tasked with resolving a bug in an objective-c mac client. I am using nsjsonserialization to serialize the json object. The bug occurs on deserialization if the json object contains the copyright…
-1
votes
1 answer

getting error while download response from api

I am downloading json from api with model class but not able to download let me show my code and expected response fro url Response SUCCESS: { "operator_list" = ( { "A_ADDRESS" = "1001, CASABLANCA, SKYLINE OASIS…
Vishal
  • 23
  • 6
-1
votes
3 answers

Swift JSON extraction

I am developing a swift iOS app and getting the following JSON response from web service. I am trying to parse and get nextResponse from it. I am unable to extract it. Could someone guide me to solve this? listofstudents: ({ …
Stella
  • 1,728
  • 5
  • 41
  • 95