This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data 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: 62142

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