0

I have a web service that I want to build a Cocoa client for. But first, I have to rebuild the web services on a more modern and robust framework. However, it seems prudent that I should be thinking about the upcoming Cocoa version during this process.

It seems all the cool kids these days are building APIs for their web services, and then dogfooding their own APIs for use with their own web/html/js and Cocoa/Android/etc clients.

So, if I was to take this approach, is there a particular data-interchange format that is conducive to both web and Cocoa, e.g. JSON, XML?

I'm pretty affluent in PHP/CodeIgniter, JavaScript/jQuery. Between those and the upcoming Objective C/Cocoa work I'll need to do, is any one of these interchange formats intrinsically easier to implement, e.g. has better CI, jQuery, or Cocoa framework support?

UPDATE:

The kind of information going back and forth will involve synchronisation of a database global to every user of the service (3-8K records, 15-20 fields each) as well as records individual to that users (10-3000). Therefore, the first synchronisation will be quite large, but successive ones a bit smaller.

jaydisc
  • 369
  • 2
  • 11

1 Answers1

2

I've been using JSON as the standard interchange format for simple data. XML is typically an overkill for relatively simple data. JSON has perfect support in jQuery, good support in PHP, and plenty of Objective-C/Cocoa libraries to get it transformed into an NSDictionary or NSArray object (and back).

Michael Petrov
  • 2,247
  • 15
  • 15
  • This is true but for exampel in the php or js saide it can be somewhat annoying to pull out specific values in deep structures... xpath and jquery selectors are good for this... but like you say if the data is going to be mostly simple JSON is a lot easier to deal with. – prodigitalson Jul 13 '11 at 05:47
  • Thank you both. I updated the post with a description of the data being transferred. It's not too layered, but there can be a lot of records. Is it pretty much down to XML for deeply layered/nested/related data, and JSON for something more simple? – jaydisc Jul 13 '11 at 06:39
  • @jay: If youre talking data sets that large i would think JSON would probably be a better way to go. I would think its going to be a lot less intensive than using XML (for sure on the php side). But i would also be concerned with dealing with a data set that large in browser based js client... – prodigitalson Jul 13 '11 at 06:47
  • Awesome. Thank you. The web client will have pagination and never load that whole dataset at once. The Cocoa client will need to work offline though and thus need to do initial and further database synchronisations, although will likely be deployed with as much pre-stored as possible. – jaydisc Jul 13 '11 at 23:12