Chapter 4: Data Formats 133
PART I
string
number
object
array
true
false
null
value
Looking closely at a string, you can see that it must be wrapped in double quotes and
that special characters must be escaped as they would be in JavaScript or C.
string
Any UNICODE character except
” or \ or control character
“ ”
\ ”
\ / b f n r t u
quotation mark
reverse solidus
solidus
backspace
formfeed
newline
carriage return
horizontal tab
4 hexadecimal digits
The following are legal strings in JSON:
""
" "
"A"
"Behold I am a string!"
"You need to escape special characters like so \" \\ \/ \b \f \n \r \t"
"Unicode is great - \u044D"
The number format is similar to the JavaScript number format, but the octal and
hexadecimal formats are not used. This makes sense, given that the format is used for
interchange rather than programming that should concern itself with memory.
number
digit
digit
digit
1–9
−
+
−
0.
e
E
digit