Encoding JSON in Objective-C with PhoneGap

I needed to encode JSON from Objective-C and send it back as a response to the JavaScript side of my app. Not immediately finding anything to suggest that PhoneGap supported JSON, all attempts to include Stig’s JSON framework failed due to name conflicts.

Fortunately, PhoneGap supports encoding JSON out of the box:

(Source: wiki.phonegap.com)