File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes json data include double quotes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "json data include double quotes" Watch "json data include double quotes" New topic

json data include double quotes

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416

The double-quota(") is used to identify the json key and value, but if the key or value include double-quota themselves, the json editor will report the error, how to handle this case? thanks
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60810

Just like anyplace else in Java or JavaScript, the quotes need to be escaped.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Krutik pandya

Joined: Dec 17, 2012
Posts: 6

you can utilize escape characters or you can also utilize XSS encoding to send data in JSON.
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
thanks for helps. the escape helps, btw, what is XSS encoding?

I agree. Here's the link:
subject: json data include double quotes
Similar Threads
hibernate 4 and spring 3.1.2 issue with LocalSessionFactoryBuilder
Getting Session on web service client
Table Viewer GUI from a Database
PGPPublicKeyRingCollection doubts