Search code examples
androidhttpurlconnectionandroid-networkingandroid-json

How to send object through HttpURLConnection without using json in android?


Is it possible to send user defined objects through HttpURLConnection without using json in android ? For example: I am creating one class and I want to send that class object without using json. Is it possible? If it is, how to proceed?


Solution

  • Yes, it is possible, but you have to write/read data into streams manually. That is why JSON is good way for doing that- all data is already formatted and is in String representation. If you don't want to bother yourself with parsing objects to/from Json, use Gson library from Google