Skip to content


Add support for @ResponseBody to return JSON #7

achuinard opened this Issue · 4 comments

2 participants


I took a bit of time trying to figure out how to properly configure JSON responses when @ResponseBody is used on a controller and Tiles when a String is returned by a controller. Would this be pretty simple to do?


JSON with @ResponseBody is pretty simple to setup.


Recently I implemented something like this (in project setup from this archetype):

@ResponseStatus(value = HttpStatus.OK)
public String handleInvalidJsonException(MethodArgumentNotValidException error) {
    LOG.warn("handling json input validation error with message [{}]", error.toString());
    return "0";

So if this works for the above, it should also work for @RequestMapping annotated method

@kolorobot kolorobot added a commit that referenced this issue
@kolorobot Issue #7: Added support for @ResponseBody to return JSON with Jackson
library; added one reference method in user controller that returns
logged in user's data as JSON

I just added support for JSON in the archetype. I hope it helps you. Thanks for the tip. See changes here: 039a56d

@kolorobot kolorobot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.