title: Android: convert Parcelable to JSON
body: <p>I am working with socket.io library which emits messages to the socket.io server. The server expects JSON objects, arrays, etc. My original implementation used JSONOject and JSONArray datatypes. However, I would like to switch to using classes generated via <a href="https://github.com/johncarl81/parceler" rel="nofollow">Parceler</a> library. The classes generated with library's annotations can be wrapped into Parcels. It seems like a very convenient way of managing such communication. However, is there a way to convert Parceler's class or a Parcel class into a JSON string or JSONObject/Array?</p>
  
  <p>GSON library supports <code>toJson</code> method and I know that Retrofit does some magic with Parcels, JSON, and GSON.</p>