Fix for events not being fired on iOS

Used NSJSONSerialization to properly encode JSON so javascript is eval'd
without 'Unexpected EOF' error.