Simple situation -
I tried gson, package from json.org,
We use Jaskson parser, here are the sample code:
protected T getJsonObject(InputStream inputStream, Class className) throws JsonParseException,
JsonMappingException, IOException {
// Deserialize input to Json object
ObjectMapper mapper = new ObjectMapper();
T jsonSource = mapper.readValue(inputStream, className);
return jsonSource;
}
Here is the code how to invoke it:
JsonEmployee jsonEmployee = getJsonObject(inputStream, JsonEmployee.class);
JsonEmployee.java is just POJO