Write a method to return json data in Controller

1. Writing method (you can add parameters and other codes that need to be executed)

@RequestMapping(value = "complete")
@ResponseBody
public Object complete() {
	Map<String, Object> map=Maps.newHashMap();
		map.put("code",1);
		map.put("msg","no");
	return map;
}

2. Run to see the results (as shown)

Published 77 original articles · 100 likes · 70,000+ views

Guess you like

Origin blog.csdn.net/super_DuoLa/article/details/104635843