Reputation:
After an hour of googling I am kind of embarrassed to ask this. But are null characters (ascii null or \0
) allowed within json? I can find that it's not allowed within json strings but my question is if it is allowed withing the body at all.
So is something like this valid:
{
"MyKey": "MyValue"\0
}
Where the \0
is an actual null character not an escaped one.
Upvotes: 8
Views: 8891
Reputation: 27460
According to JSON specification JSON cannot contain \0
, only spaces between tokens:
Insignificant whitespace is allowed before or after any of the six
structural characters.
ws = *(
%x20 / ; Space
%x09 / ; Horizontal tab
%x0A / ; Line feed or New line
%x0D ) ; Carriage return
https://www.rfc-editor.org/rfc/rfc7159
Upvotes: 4