Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Finally, the JSON Encoder

DZone's Guide to

Finally, the JSON Encoder

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

I did this post quite a while ago about my experiences in using JSON to connect iPhone/iPad apps to a backend. At the time, I found sbjson, but was unhappy with the fact that it ignored the NSCoding protocol, and thus, it ended up insinuating itself into a large part of your codebase. So my original solution was to use sbjson, but only in one place: where the encoder and decoder need to handle JSON. I said I would open source it and never did (despite a lot of people asking for it). The main reason was I just didn‘t get around to preparing it and I wanted an even better solution.

Well, in the meantime, I found out not long ago that Apple added a class to the iOS SDK that handles JSON! So at long last, here is an NSCoding implementation that has no other dependencies and lets you serialize your entities to and from JSON with ease.

Of course, it‘s housed on GitHub. I didn‘t add a license agreement but am releasing it free of any restrictions (MIT).

JSONEncoder

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:

Published at DZone with permission of Rob Williams, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}