Created
June 19, 2021 07:38
-
-
Save learnit-codeit/f0ec28a3ab31c5c95ef6359398c179f4 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
@Controller | |
@RequestMapping("/rest1") | |
public class MyController { | |
@RequestMapping(value="/getdata", method = RequestMethod.GET, produces = "application/json; charset=UTF-8") | |
@ResponseBody | |
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