I want to create a custom json response for a new Java Spring Boot application. At the moment I just want to create a dummy json object -- to start controlling the structure of the output json response.
When I do this it wants to create cast prefixes to the .puts -- I used to use Mongodb -- BasicDBObject -- but now I've not got mongo here.
DBObject obj = new BasicDBObject();
obj.put( "foo", "bar" );
what do I do instead?
--
@RequestMapping(value = "/login", method = RequestMethod.GET)
@CrossOrigin(origins = {"*"})
public ResponseEntity<?> login(
@RequestParam(value="email", required=false, defaultValue="email") String email,
@RequestParam(value="password", required=false, defaultValue="password") String password,
HttpServletRequest request
) throws Exception {
Object response = new Object();
response.put("information", "test");
response.put("id", 3);
response.put("name", "course1");
return new ResponseEntity<>(response, HttpStatus.OK);
}