問:html
I'm trying to show double quotes but it shows one of the backslashes:json
"maingame": { "day1": { "text1": "Tag 1", "text2": "Heute startet unsere Rundreise \\\"Example text\\\". Jeden Tag wird ein neues Reiseziel angesteuert bis wir.</strong> " } }
When rendering in the html it shows as \"Example text\". What is the correct way?ui
答:this
Try this:spa
"maingame": { "day1": { "text1": "Tag 1", "text2": "Heute startet unsere Rundreise \" Example text\". Jeden Tag wird ein neues Reiseziel angesteuert bis wir.</strong> " } }
(just one backslash (\) in front of quotes).code
JSON字符串中的轉義字符和C#同樣,都是用反斜線"\"開頭的,例如:orm
\b Backspace (ascii code 08) \f Form feed (ascii code 0C) \n New line \r Carriage return \t Tab \" Double quote \\ Backslash character
參考文獻:htm
How to escape double quotes in JSONblog
How to escape special characters in building a JSON string?ci