How can i append a line in the json structure.Input JSON is provided by user as html request and each time we need to add date or any other feature in new JSON and return as html response.
Example: if my json file is: {name: abc, age: 12} then my new output json will be {name: abc, age: 12, date:26/09/2017}
CODE:
InputStream inputStream = request.getInputStream();
String text = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name());
JsonObject convertedObject = new Gson().fromJson(text, JsonObject.class);
convertedObject.addProperty("Date", "26/09/2017");
PrintWriter pw = response.getWriter();
pw.println(convertedObject.toString());
By above code the exisiting json gets deleted only the date displays :(