How do I post JSON data to a server in Android in 2017?

4 Answers

Varun Chandran

This Question is little confusing, why 2017?

Anyway, we always use HTTP methods GET, POST, PUT etc. for transmission of data over network.

Those are requests,

GET is used to retrieve remote data, and POST is used to insert/update remote data , and PUT is used to create/overwrite it.

If you are looking for libraries that help you for this.

  1. Volley
  2. OKHttp
  3. Retrofit
  4. Rxjava2

There are some you must go through for this..These are not necessary, You can use apache httpclient for that.

For better understandings, go through

Top 5 Android libraries every Android developer should know about

The Best Android Networking Library for Fast and Easy Networking

Using Kotlin in Android Studio 3.0 (Part 4) - DZone Mobile

These may help you.

Best of luck

Lakshmi Suvvada

TO send JSON data from Android app to a server , refer the below url :

Android | Send “POST” JSON Data to Server

which is best link with example.

Tejas Pandya

If you are familiar with volley library than this may be easy for you . if you haven’t then just refer this link ..

Android working with Volley Library

Now you need to just build up your main JSON object and using volley’s JSONObject request . you can easily pass JSON data to server.

Happy Coding.

Aakash Alurkar