Seeking guidance on how to retrieve Json data stored in a Java variable using JavaScript. Instead of accessing the data, the html source is displayed.
Java:
Gson gson = new Gson();
String json = gson.toJson(obj);
request.setAttribute("gsonData", gson);
JavaScript:
var dataset = ${gsonData};
The content in the html page source:
var dataset = {serializeNulls:falsefactories:[Factory[type=com.google.gson.JsonElement,
adapter=com.google.gson.internal.bind.TypeAdapters$25@719474],
com.google.gson.internal.bind.ObjectTypeAdapter$1@31d22,
... // (data continues)
instanceCreators:{}};
In what way can I appropriately access this data?