I\'m using renderJSON(Object) to return some objects as JSON values, and it\'s working fine except for one field. Is there an easy way to add in that one field
renderJSON(Object)
Simply do a
JsonElement elem = new Gson().toJsonTree(yourObject); JsonObject obj = elem.getAsJsonObject(); obj.remove("xxx"); obj.addProperty("xxx", "what you want"); // other stuff ... renderJSON(obj.toString());
etc.