Created
June 19, 2021 07:39
-
-
Save learnit-codeit/8332d689bd2a685e08edf6abd57e43d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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