I have to say that the JSON format is indeed very good, fast and simplified a lot of operations.
In Android, the android SDK has encapsulated the entire JSON-related operation for us, which is very convenient to use.
The following is the implementation process of a standard JSON request:
Httppost request = new httppost (URL); <br/> // encapsulate a JSON object <br/> jsonobject Param = new jsonobject (); <br/> param. put ("name", "rarnu"); <br/> param. put ("password", "123456"); <br/> // bind to the request entry <br/> stringentity Se = new stringentity (Param. tostring (); <br/> request. setentity (SE); <br/> // send the request <br/> httpresponse = new defaulthttpclient(.exe cute (request); <br/> // the string to be replied, this is also the data stored in JSON format <br/> string retsrc = entityutils. tostring (httpresponse. getentity (); <br/> // generate a JSON object <br/> jsonobject result = new jsonobject (retsrc); <br/> string token = result. get ("token ");
Support JSON remote access under Android (recommended this blog): http://marshal.easymorse.com/archives/1707
About Android JSON writing class -- jsonwriter, easy to generate data in JSON format: http://disanji.net/2011/03/05/android-3-0-json-jsonwriter/
Android JSON parsing sample code, daily wiki Widget: http://www.android123.com.cn/androidkaifa/664.html
The client sends data to the server, one is in the URL with parameters, one is the JSON data transmission method (small stranger): http://henzil.easymorse.com /? P = 241
Android access PHP retrieve JSON data: http://blog.lrenwang.com/post/114/
How to send a request with an android JSON object:
Http://cn.webdiscussion.info/question/3027066/if he sends a request with android-jsonobject