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
-2
votes
1 answer

understand JSON parse to NSDictionary

Possible Duplicate: NSJSONSerialization from NSString I have this old code, how do I accomplish using NSJSONSerialization? Below uses SBJSON + (NSDictionary *) parseJSONResponse: (NSString *) response { NSDictionary *dictionary = [response…
William Falcon
  • 9,813
  • 14
  • 67
  • 110
-2
votes
3 answers

Display JSON as List in ViewController (Not in TableView)

I am producing a JSON string that I need to parse out and display onto the page. My JSON string outputs information about the contents of a CD like this: [{"song_name":"Song 1","artist":"John","price":"$1"}, {"song_name":"Song…
Brandon
  • 2,163
  • 6
  • 40
  • 64
-3
votes
2 answers

Read Json Response from server and parse in objective-c xcode

Fresher in iOS trying to parse the json data i am receiving from server. Below is my json response. { "msg": "success", "data": { "id": "1", "salutation": "Mr.", "first_name": "DIPAK NARANBHAI", "last_name":…
-3
votes
1 answer

json converting to array swift

I get json like this from the server: array('id' => '1', 'name' => 'Radni nalog 1', 'threadTypeList' => array( array('id' => '1', 'name' => 'Crvena'), array('id' => '2', 'name' => 'Plava'), array('id' => '3',…
-3
votes
1 answer

scope of do-catch in swift - cannot assign value to outside variable

I have made some code to make POST request to my php script which is placed on my servers. I have tested and that part is working fine. I got the problem with the returning result from the server - I get it in JSON format, and print in inside…
-3
votes
2 answers

How to export .JSON file using NSMutableDictionary?

I have NSMutableDictionary inside this values are present like this { 0 = { imageangle = "0.09630692"; imageheight = "129.0245"; imagepath =…
Kishore Kumar
  • 4,265
  • 3
  • 26
  • 47
-3
votes
2 answers

Converting JSON string into object

I am trying to convert a JSON string into an object in Objective C using the code: NSString *jsonString = (NSString *) responseObject; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; id json = [NSJSONSerialization…
Ashish Agarwal
  • 14,555
  • 31
  • 86
  • 125
-3
votes
1 answer

crashing app when parsing json from url iOS

I want to parse JSON from url and NSLog it. this is my url : http://api.kivaws.org/v1/loans/search.json?status=fundraising and this is my code . when I run my code this crashing..... NSURL * url=[NSURL…
MmD
  • 2,044
  • 5
  • 22
  • 41
-3
votes
1 answer

How to fetch the data from JSON using key in iPhone

Hey I'm new to iPhone and I have been trying to parse the below JSON for displaying different types of Survey using my below code. I have two tables, in first table i want to display all the "Surveys_title" text value, and once user will tap on any…
user2786
  • 656
  • 4
  • 13
  • 35
-3
votes
1 answer

JSON posting in iOS not working (.NET server)

Posting request to .NET server is not working. NSDictionary *jsonDict = [NSDictionary dictionaryWithObjects:objects forKeys:keys]; NSURL *postURL = [NSURL URLWithString: @"SOME URL"]; NSError *error=nil; NSData *jsonData = [NSJSONSerialization …
-3
votes
1 answer

iOS parsing a jsonDictionary

I am from php domain, and now learning ios coding. I want to make a view with one part showing user info, and a table showing friends details. I can get the json Logged correctly. My json looks like this: {"Me": {"username":"aVC", …
aVC
  • 2,254
  • 2
  • 24
  • 46
-4
votes
2 answers

Post request in swift with encodable

I want to create a post request in swift but i got confused in Encodable protocols. and how to create them. below is the data that i want to post : { answers: [{ "time": 1, "score": 20, "status": true, …
AMAN SHARMA
  • 21
  • 1
  • 5
-4
votes
2 answers

How to take values from given JSON in swift2.3

let result = try?NSJSONSerialization.JSONObjectWithData(data,options:.MutableContainers) How to take values from given JSON in swift2.3 ({ FirstName:"sample" LastName:"Data" }, { FirstName:"sample1" …
Senthil
  • 75
  • 10
-4
votes
2 answers

JSONSerialization AnyObject SWIFT3 Conversion Issues

I have converted to Swift 3 and I have received the following errors when assigning to AnyObject the JSONSerialization.jsonObject. Has anyone come across this issue and know the fix?
Silent
  • 641
  • 1
  • 16
  • 34
-4
votes
3 answers

NSJSONSerialization doesn't parse this JSON

I'm trying to parse this JSON that looks to me like well written, but NSJSONSerialization doesn't think the same AFAIK since it's returning an NSArray. This is my code: NSData* gamesData = [NSData dataWithContentsOfURL: …
1 2 3
47
48