Chapter 10

Adding the JSON Response

In This Chapter

arrow Seeing how JSON is structured

arrow Using the JSON deserializer that comes with iOS

JSON is a lot like XML, but different, as you can see in Listings 10-1 and 10-2. Currently, JSON is winning favor over XML when it comes to serializing and transmitting structured data over a network connection (such as from a server and an application). I don’t get into which one is better — I know better than to get in the middle of a civil war — but the way JSON is structured makes it more desirable for the kinds of web services you’ll be working on. I could, of course, be all even-handed and point out that many folks believe you should use XML, but I won’t get into that here because, frankly, I have trouble being so darned even-handed all the time. Pick the one you like and go with it, but it seems to me that JSON is the freight train these days, and XML has been regulated to the milk run.

Working with JSON

JSON (an acronym for JavaScript Object Notation; often — but not always — pronounced like the name Jason) is derived from the JavaScript programming language and does a great job of representing simple data structures and associative arrays, called objects. Even though it has JavaScript in its name, it is language-independent, and there are parsers ...

Get iOS Cloud Development For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.