Is there an easy way to return data to web service clients in JSON using java? I\'m fine with servlets, spring, etc.
Yup! Check out json-lib
Here is a simplified code snippet from my own code that send a set of my domain objects:
private String getJsonDocumenent(Object myObj) (
String result = "oops";
try {
JSONArray jsonArray = JSONArray.fromObject(myObj);
result = jsonArray.toString(2); //indent = 2
} catch (net.sf.json.JSONException je) {
throw je;
}
return result;
}