Created
October 25, 2012 01:39
-
-
Save lyuehh/3949992 to your computer and use it in GitHub Desktop.
json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON 字面量 | |
>>> ({"a":"\a"}) | |
Object { a="a"} | |
>>> ({"a":"\\a"}) | |
Object { a="\a"} | |
>>> ({"a":"\\\a"}) | |
Object { a="\a"} | |
>>> ({"a":"\\\\a"}) | |
Object { a="\\a"} | |
JSON.parse() | |
>>> JSON.parse('{"a":"\a"}') | |
Object { a="a"} | |
>>> JSON.parse('{"a":"\\a"}') 报错 | |
>>> JSON.parse('{"a":"\\\a"}') 报错 | |
>>> JSON.parse('{"a":"\\\\a"}') | |
Object { a="\a"} | |
JSON.stringify() | |
>>> JSON.stringify({"a":"\a"}) | |
"{"a":"a"}" | |
>>> JSON.stringify({"a":"\\a"}) | |
"{"a":"\\a"}" | |
>>> JSON.stringify({"a":"\\\a"}) | |
"{"a":"\\a"}" | |
>>> JSON.stringify({"a":"\\\\a"}) | |
"{"a":"\\\\a"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment