So, I have this method here:
@RequestMapping(value = "/getFields", produces = "application/json")
public Response getFields(@RequestParam(value = "id") int id)
and I have a class which extends Response.
In this class, I have defined a JSONArray
, in which I put a JSONObject
through a method which wraps JSONArray.put(JSONObject obj)
.
At the end of my getRegistrationFields I return the instantiated object of the class extending Response.
This way, Spring should return the JSONArray contained in this object, and I should see it when I call "/getFields" REST method.
However, it gives me an Error 500
Could not write content: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer
Is there a quick way to fix this?