Json parsing in xcode

This code is use for the creating the parse data using the json parsing.in that the one url insert into the constant file and then that url to call server and which the response send into object form like (NSArray and NSDictionary) form that object store into variable and that variable can use into the application.

 

1) Copy paste the below file into your project.

2) Create new Group name as help which contain the following files.

3) Create the new file into Support Files which is name as a constant.h

4) Change the above the variable  link where is your web service exist that means url of your webservice  “WEB_SERVICE_URL”

5)  Open “Rest.h” file and create the one method.

6) Open “Rest.m” file and which argument to pass to server that method to code.

7) now the Rest application is ready for the send the request and then now this method call in to our view controller.

  • Following code put into the “viewWillAppear” method in .h file

  • Following code put into the “viewWillAppear” method in .m file and import “Rest.h”.

  • Then the reply comes into server that time object store into the variable that time we create the metod which calls.

8) Now the application is ready for the sending the request and that reply to handle into our application.

Output

Grab the sample code from here.

3 thoughts on “Json parsing in xcode

  1. You can also use c-strings (“”) rather than NSStrings (@””) as keys (although this would likely crash nastily or just not compile). The key should be something than can be cast to id.

    • Hi ! Web-services provides the data. Based on the request sent by the client, web-server will responds you back. Web-services may either give XML or JSON response or may be some other kind of response.

      Based on the response, different parsers are used to covert response to Objective-c data.
      For example, converting XML to NSArray or NSDictionary.

      I hope this is what you were asking for.

Leave a Reply

Your email address will not be published. Required fields are marked *



*