I want to know how can I convert a Java object to JSON by using DWR. I have already tried
JsonUtil.toJson(myObject), but it gives a NullPointerException at org.directwebremoting.json.JsonUtil.toJson(JsonUtil.java:127). Can anyone tell me any way of converting the Java Object to JSON? I would prefer achieving it by DWR.
Why not use the JSON library itself? JSON
Or even the Google-Gson Library GSON
Also, for further reference, use the Search, since similar questions to this one have been answered…
a few examples:
https://stackoverflow.com/questions/338586/a-better-java-json-library
Converting JSON to Java