HTTP POST allows you to send data to the server in different formats such as XML, JSON or binary. Of course, the server should be ready to handle data in the selected format. This article shows how to send JSON data from Android app to a server that can handle it.
Most Internet services will serve “send” you the data you requested “using HTTP GET/POST request” in JSON format. If your Android app is depending on sending and receiving data over the Internet e.g. interacting with social network API, you will definitely need to deal with JSON formatted data in your apps. This article shows how to send HTTP GET request to a rest service that returns data in JSON format & how to parse received JSON data.
This is a complete example showing how to send jQuery.Ajax() POST request containing data in JSON format to the server, and how to receive this JSON content, parse it and map it into Java objects in the server “servlet” side. Also, we will see how to send the list of all received data back to the client in JSON format and how the client can parse this data and display it.
- How to send jQuery.ajax() POST request with data in JSON format?
- How to receive JSON data in Java servlet, parse it and map it into Java objects?
- How to send data back to the client in JSON format too?
jQuery-File-Upload js library is “so far” the most elegant, smart, simple..etc js library I have used to upload files. Simply it is amazing. It supports async upload “Ajax”, multiple files upload, drag&drop, progress update and a lot more. Here we will see how to upload multiple files to Java “Servlet” app and how to deal with uploaded files using Java Servlet API or Apache FileUpload Library. Bootstrap has been used in this example to make the UI more attractive.
- How to upload single or multiple files using jquery.fileupload.js?
- How to receive uploaded files using Java Servlet API?
- How to receive uploaded files using Apache FileUpload lib?
google-gson is Java library to convert Java object to JSON and JSON to Java object.
- How to use gson library to convert Java to JSON and JSON to Java?
Converting Java objects to JSON and JSON to java objects is a common function in most apps. Jackson is a Java library that enables you to do so easily.
- How to convert Java object into JSON and back again to Java?
- How to convert between Generic collection and JSON?
- How to build Java tree model for JSON?
- How to configure Jackson using annotations?
Content negotiation in Spring MVC allows you to view data in different format based on the request media type. Here we will see how to view the same data in different media types “json, xml, pdf & excel”.
Using Spring MVC we can send to the client data in JSON format, but what if the client sends POST request with data in JSON format? Here we will see how Spring MVC “auto” maps JSON data sent by client POST request into Java object.
This post is about building a RESTfull client using rest.js which belongs to cujo.js family.
If you want to build SPRING MVC REST application without using rest.js look at these posts
- Spring MVC JSON (JSON to Java)
- Spring MVC View JSON | XML | PDF
- Spring MVC return JSON using @ResponseBody