The problem is this:
Using the MVC framework for Spring MVC, when an HTTP request is made, the data return is actually double-quoted, which leads me to convert the data in the foreground. So, what is the specific cause of this? Look at the code below and you'll know!
1) spring-servlet.xml
<!--JSON conversion of the returned JavaBean back to the foreground--><bean name= "Mappingjacksonhttpmessageconverter" class= " Org.springframework.http.converter.json.MappingJacksonHttpMessageConverter "/>
2) Controller.java
@RequestMapping ("/querysubstation") @ResponseBodypublic String get (httpservletrequest request, HttpServletResponse Response) {list<treedto> List = new arraylist<treedto> (); Treedto father = new Treedto () Father.setid ("_001"); Father.settext ("Xiang"); List.add (father); return Jsonarray.fromobject (list). ToString ();}
3) The result of the return is
"[{\" attributes\ ": {},\" checked\ ": False,\" children\ ": [],\" iconcls\ ": \" \ ", \" id\ ": \" _001\ ", \" parent_id\ ": \" \ ", \" State\ ": \" open\ ", \" text\ ": \" Xiang change \ "}]"
4) Problem finding
The problem is that when the data is returned to the client, the JSON format was converted two times, so the problem occurred! It's easy for you to deal with! 1) One way to comment out the Spring-servlet code.
2) One way to return the Java object itself instead of JSON conversion.
Spring MVC response results have double quotes