a Web program that SPRINGMVC a schema, usually displayed in a browser with a map return message, but actually reports the following error
"You ' re trying to decode an invalid JSON String"
The returned string was added to the <pre></pre>,
workaround, add the following configuration to the SPRINGMVC configuration file:
<bean
class= "Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
<property name= "Messageconverters" >
<list>
<bean
class= "Org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
<bean id= "Jsonhttpmessageconverter"
class= "Org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" >
<property name= "Supportedmediatypes" >
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
At the same time, @ResponseBody annotations are added to the controller method body.
Another workaround is to return a message in the form of an array, such as:
resultText =
"{success:true,info:‘成功‘}"
;
You ' re trying to decode an invalid JSON String JSON returns a parsing problem