I am new in ios development so I need step by step guidance from basic level, I use many link but all are providing me direct project code and then start I need to understand how all thinks work like layout and development.
Asked
Active
Viewed 102 times
-3
-
2Welcome to StackOverflow!! Please, refer this http://stackoverflow.com/help/how-to-ask to ask a proper question. – Rumin Oct 29 '15 at 13:37
-
1Possible duplicate of [JSON Parsing in iOS 7](http://stackoverflow.com/questions/19404327/json-parsing-in-ios-7) – brandonscript Oct 29 '15 at 13:46
3 Answers
2
You can use NSJSONSerialization class https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSJSONSerialization_Class/
NSDictionary *responseObject = [NSJSONSerialization
JSONObjectWithData:responseData options:self.readingOptions
error:&serializationError];

K_Mohit
- 528
- 3
- 17
-
1Then ask a detailed question with what you are trying to do **what you tried** and what doesn't work. – deadbeef Oct 29 '15 at 13:40
-
1Your json object is converted to NSDictionary so you can use this in anyway what else you are expecting? Explain how you want to use? – K_Mohit Oct 29 '15 at 13:41
-
Yes, I need one step by step example.like step-1 create xcode new project. step-2 and so on.... – Ketan Patel Oct 29 '15 at 13:48
0
For json parsing you can use AFNetworking. Its Very easy and helpful platform with simple and complex json parsing.
You can use below link for more information
http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial

Maulik Patel
- 397
- 4
- 15
0
For json parsing,you can use simple NSJsonSerialization.You can do POST for posting data to server using json parsing post and also you can get the data from server using json parsing GET mthod.
First POST for posting data to SERVER
//STEP 1 :Here give YOUR URL instead of my URL
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://192.168.3.128:8050/RestWebService/rest/person"]];
//STEP 2 :create the Method "POST"
[request setHTTPMethod:@"POST"];
//STEP 3 :Pass The String to server(YOU SHOULD GIVE YOUR PARAMETERS INSTEAD OF MY PARAMETERS)
NSString *userUpdate =[NSString strin gWithFormat:@"user_email=%@&user_login=%@&user_pass=%@& last_upd_by=%@&user_registered=%@&",txtemail.text,txtuser1.text,txtpass1.text,txtuser1.text,datestr,nil];
//STEP 4 :Check The Value what we passed
NSLog(@"the data Details is =%@", userUpdate);
//STEP 5 :Convert the String to Data
NSData *data1 = [userUpdate dataUsingEncoding:NSUTF8StringEncoding];
//STEP 7 :Apply the data to the body
[request setHTTPBody:data1];
//STEP 8 :Create the response and Error
NSError *err;
NSURLResponse *response;
//STEP 9 :send synchronous request to server
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
//STEP 10 :getting the response
NSString *resSrt = [[NSString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];
//STEP 11:Check whether we got the Response or Not
NSLog(@"got response==%@", resSrt);
if(resSrt)
{
NSLog(@"got response");
}
else
{
NSLog(@"faield to connect");
}
Second Getting Response From Server Using NSJsonSerialization method
//STEP 1 :Here give YOUR URL instead of my URL
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.worldweatheronline.com/free/v1/search.ashx?query=London&num_of_results=3&format=json&key=xkq544hkar4m69qujdgujn7w"]];
//STEP 2 :create the Method "GET"
[request setHTTPMethod:@"GET"];
//STEP 3 : set request as Json format value type
[request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"content-type"];
//STEP 4 : Create the response and Error
NSError *err;
NSURLResponse *response;
//STEP 5 :send synchronous request to server
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
//You need to check response.Once you get the response copy that and paste in ONLINE JSON VIEWER.If you do this clearly you can get the correct results.
//After that it depends upon the json format whether it is DICTIONARY or ARRAY
//STEP 6 :Get the response to dictionary or array depends upon the response
NSDictionary *jsonArray = [NSJSONSerialization JSONObjectWithData:responseData options: NSJSONReadingMutableContainers error: &err];

user3182143
- 9,459
- 3
- 32
- 39