你有什麼是JavaScript,而不是JSON。
如果你想JSON:
{
"movielist": [
"Friday the 13th",
"Friday the 13th Part 2",
"Friday the 13th Part III",
"Friday the 13th: The Final Chapter",
"Friday the 13th: A New Beginning"
]
}
如果你想有一個JavaScript對象
var movielisttext = {
"movielist": [
"Friday the 13th",
"Friday the 13th Part 2",
"Friday the 13th Part III",
"Friday the 13th: The Final Chapter",
"Friday the 13th: A New Beginning"
]
};
如果你想包含JSON一個JavaScript字符串:
var movielisttext = '{"movielist": ["Friday the 13th","Friday the 13th Part 2","Friday the 13th Part III","Friday the 13th: The Final Chapter","Friday the 13th: A New Beginning"]}';
或
var movielisttext = "{\"movielist\": [\"Friday the 13th\",\"Friday the 13th Part 2\",\"Friday the 13th Part III\",\"Friday the 13th: The Final Chapter\",\"Friday the 13th: A New Beginning\"]}";
由於數據本身不包含任何"
字符,因此就JSON而言,不需要轉義它們。
http://stackoverflow.com/questions/2275359/jquery-single-quote-in-json-response – 2010-11-06 16:48:03