Featured post

Difference between protocol and delegates?

A protocol, declared with the ( @protocol syntax in Objective-C) is used to declare a set of methods that a class "adopts" (de...

Tuesday, 28 April 2015

Parsing JSON vs parsing XML in iOS

Checkout this tutorial about parsing XMLs. I might sound opinionated, but if there's a choice go for JSON, although I have no clue what situation your project is in. I would certainly look at the entire architecture (trade-offs and choices) of the project before making a decision. From my experience, understanding JSON and relating it to NSDictionaries and NSArrays is much easier than understanding XMLs.

When JSON is preferred it is usually because it is significantly shorter. That saves transmission traffic and therefore time and battery power (not a bad thing, though?). Meaning: Even if parsing JSON would be slower (which I doubt), the gain during the tranfer over the air would certainly compensate any additional CPU time during parsing. 

No comments:

Post a Comment