Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send json object using http post method for android application

Tags:

android

i am trying to send JSON object to my php webservice.

I have referred this url :- http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/

In my web service, I have to pass username and password but i don't know,

what is the GSON. can you tell why GSON use in this.????

I am new in json. if you know about json please guide me to solve this problem.

like image 941
milan manvar Avatar asked Feb 01 '11 11:02

milan manvar


People also ask

Can we send JSON object in post request?

To post JSON to a REST API endpoint, you must send an HTTP POST request to the REST API server and provide JSON data in the body of the POST message. You also need to specify the data type in the body of the POST message using the Content-Type: application/json request header.

What is post method in JSON?

post() method allows you to send asynchronous http POST request to submit and retrieve the data from the server without reloading whole page. Syntax: $.post(url,[data],[callback],[type]) Specify type parameter for the type of response data e.g. specify 'JSON' if server return JSON data.


1 Answers

GSON is a Java library to convert java objects to JSON and vice-versa. You don't need it unless you have some complex JSON structure. For simple objects you can easily construct the JSON string yourself.

like image 92
kgiannakakis Avatar answered Nov 15 '22 03:11

kgiannakakis