I use "Jsonitter" as a JSON serialization framework and I don't use Maven in my project. I've been returning JSON objects in in my restful api by directly writing the result of the "Jsonitter" to the HttpServletResponse
until now that I found about the @RestController
attribute. Being from an ASP.Net MVC background, I expect the framework to automatically serialize the returned object in my api in accordance with the Accept
header. But I feel like, Spring requires a third-party serialization framework to render the result (i.e. Jackson) because it returns HTTP Status 406 - Not Acceptable
result instead.
The way I'm using it is as follows:
@RestController
@EnableWebMvc
public class TestApi {
@RequestMapping(value = "Test", method = RequestMethod.Get, produces = "application/json")
public List<String> letsTest(){
return myStringList;
}
}
I don't have any reference to Jackson and I'd rather not use it at all and I feel like the error is due to that. Is there any way to get this work without Jackson?