Skip to content

Instantly share code, notes, and snippets.

@learnit-codeit
Created June 19, 2021 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save learnit-codeit/8332d689bd2a685e08edf6abd57e43d4 to your computer and use it in GitHub Desktop.
Save learnit-codeit/8332d689bd2a685e08edf6abd57e43d4 to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/rest")
public class MyRestController {
@RequestMapping(value="/getdata", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getMyData() {
JSONObject obj=new JSONObject();
obj.put("name","Anish Antony");
obj.put("age",27);
obj.put("salary",10000);
return obj.toJSONString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment