Write a JSON REST Service

This is a demo

Any Spring @RestController in a Spring Boot application should render JSON response by default as long as Jackson2 is on the classpath, as shown in the following example: JavaKotlin @RestController public class MyController { @RequestMapping("/thing") public MyThing thing() { return new MyThing(); } } As long as MyThing can be serialized by Jackson2 (true for a normal POJO or Groovy object), then localhost:8080/thing serves a JSON representation of it by default. Note that, in a browser, you might sometimes see XML responses, because browsers tend to send accept headers that prefer XML.