Recently, there is a project need to use the transmission of JSON, before not too understand, in the Internet to find some relevant information, wrote a small demo, to achieve the basic function: Androidclient send JSON to the server, the server to use JSP to receive, After parsing, return to Client,client as JSON to receive printing, first look at the effect of execution, the source code will be given at the end of the article.
1. Server: Parse print after receiving JSON, then send JSON to client
2.client, after receiving the JSON returned by the server to print
Simple introduction of the following source code:
The server uses json.jsp to receive parsing of the Json,json the client passes through the jar package under the Lib folder, which needs to be executed using Tomcat, the source code folder structure such as the following:
The client is very easy, all implemented in Mainactivity, the source code folder structure such as the following:
Source code Download point here ^ ^
Transfer and parsing of JSON between androidclient and service side (JSP) "attached source code"