Devang
Devang

Reputation: 11338

iPhone : Which type of parser recommended for data parsing between iPhone and web-service?

Can any body tell me which parser is best in my condition? XML, JSON or any else ?

The app contains feature link sync the data, communicate with the web-service and etc. So I am targeting parser which is light weight and fast.

I have lots of data which are parsed between iPhone and server.

Which are the option? Or any good link for comparison between different parser ?

Upvotes: 2

Views: 1014

Answers (4)

Janak Nirmal
Janak Nirmal

Reputation: 22726

If you would like to know about different XML Parsers available and comparison between them, you can visit this tutorial which shows different xml parsers available and comparison between them.

Upvotes: 0

Ajay Sharma
Ajay Sharma

Reputation: 4517

Of course it's JSON.

This is the frequent question asked on stack.You could find much better answer just by Goggling. JSON has several advantages over XML. Its a lot smaller and less bloated, so you will be passing much less data over the network - which in the case of a mobile device will make a considerable difference.

Refer to JSON Tutorial for iPhone.

Upvotes: 1

Yuvaraj.M
Yuvaraj.M

Reputation: 9811

Mr.Devang. I recommend NSXMLParser. If your data or response from service will be in XML format please use NSXMLParser. Apple have inbuilt xml parsing tool. Please refere Apple document fir NSXMLParser,

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html
http://developer.apple.com/library/mac/#documentation/cocoa/reference/NSXMLParserDelegate_Protocol/Reference/Reference.html

And also, if you receive your web-service response in JSON format, you can use SBJSON to parse the JSON files. You can get the json framework form this link,

https://github.com/stig/json-framework/

Thanks.

Upvotes: 0

Srikar Appalaraju
Srikar Appalaraju

Reputation: 73588

I would suggest JSON as in terms of data size json tends to be compact compared to XML. Which will reduce time spent in network transfer (for your data).

You could use any available JSON parsers to directly get ObjectiveC objects. Some Json parsers -

  1. NSJSONSerialization
  2. json framework
  3. jsonKit

I personally prefer jsonKit as its supposed to be fastest of all.

Upvotes: 2

Related Questions