Finally, the JSON Encoder
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.
Published at DZone with permission of Rob Williams, author and DZone MVB. (source)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).
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





