I have this in my spring project
@RequestMapping(value = "/show", method = RequestMethod.GET)
public String view(ModelMap request, @RequestParam("items") String Items){
System.out.println(Items);
}
Prints the below json
{
"items":[
{
"price":30
},
{
"price":"50"
}
]
}
but when I pass the above json data to JSP file it converts to this
{"items":[{"Price":"30"},{"Price":"50"}]}
How to decode this so I can display properly in my view? And btw the above req param I am getting is encoded url JSON.
Your double quotes get converted to this " HTML ASCII because you are not using escape characters. You can use \" (escape character, to pass double quotes as it is.).
forex.
String jsonData = "{ \"key\" : \"value\" }";
Or you can use a library such as Jackson to Parse your JSON for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.