Recently, a project needs to use json transmission. I didn't know much about it before. I found some related information on the Internet and wrote a small demo to implement the basic functions: the android client sends a json message to the server. The server receives the message in jsp format and returns it to the client in json format. The client receives the message and prints the message. The source code is provided at the end of the article.
1. SERVER: parse and print the received json and then send the json to the client.
2. The client receives the json returned by the server and prints it.
A Brief Introduction to the source code:
The server uses json. jsp to receive the json received by the parsing client. For json parsing, the jar package under the lib directory must be used and tomcat should be used for running. The source code directory structure is as follows:
The client is simple and implemented in MainActivity. The source code directory structure is as follows:
Download point here ^