issue with html data returned as json
I have this html data -
<img width="138px" height="74px" rev="om" src="//www.xyz.net/abc/2/3/4/data/image/data_6812?wid=138&hei=74&qlt=90,0&resMode=sharp&op_usm=1.1,0.5,1,0" alt="category"/><p>Category</p>
but when I call and get the json it not able to traslate the html properly and spits the output as -
{"name":"<img width="\" height="138px\\" rev="74px\\" src="om\\" alt="//www.xyz.net/abc/2/3/4/data/image/data_6812"/><p>Category<\/p>"}
instead it should have been like if it was correctly escaped-
<img width=\"138px\" height=\"74px\" rev=\"om\" src=\"//www.xyz.net/abc/2/3/4/data/image/data_6812\" alt=\"Category\"/><p>Category</p>;
in my servlet I have set the content type as - application/json and the when I print the out put in my log file it is correctly escaping and showing the right value but in the browser it does not.
I have disabled the link checker, but still it does not load correctly. Does anyone know what else I need to do in order to have html data correctly being displayed on the browser? I could use the StringEscapeUtils.escapeHtml method but it escapes the whole html which is not desired.
Thanks.