Monday, 26 August 2013

Error while getting JSON when data has spaces

Error while getting JSON when data has spaces

I am facing issue while fetching json data when data has white spaces .
I am using spring, In spring controller i am doing like below,
String json=new Gson().toJson(agents, new TypeToken>() { }.getType())
I am able to see proper json in logger too, after that I am setting to
model attribute like below one
model.addAttribute("json",json);
here model is 'org.springframework.ui.ModelMap'
In JSP I am able fetching data till no space found.
Example :
Original JSON String: ILOVE JAVA Fetching strin : ILOVE
Only please help me out this with out using encoding string.

No comments:

Post a Comment