Outputting JSON with angle brackets in browser -


currently i'm working on small webservice outputs json client. testing purposes let json output on browser (firefox 20). within json use tags declaring text in different languages seems causes trouble browser filters start tag.

i guess browsers (i tried on chrome , opera) think tags html , try handle it. put json code in code-tags , pre-tags result same.

in other words, get:

"description":"bild 1<\/de>image 1<\/en>\u5199\u771f\u7b2c\u4e00<\/jp>" 

what want:

"description":"<de>bild 1<\/de><en>image 1<\/en><jp>\u5199\u771f\u7b2c\u4e00<\/jp>" 

important: output have (says debugger), it's how browser shows it. there possibility let browsers ignore tags or have use "& lt;" , "& gt;"? thank you!

escaping xml might seem immediate solution, not. break original webservice.

please recheck if sending below header in response:

content-type: application/json 

the above header make browsers interpret response json (and not html)


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -