In standard JSON, spaces outside of string literals are ignored, as was said.
However, since your question is marked with C #, I should note that there is at least one other case in C # /. NET where space in JSON matters.
The DataContractJsonSerializer uses the special __type property to support deserialization into the correct subclass. This property must be the first property in the object and not have spaces between the name of the property and the preceding { . See this topic: DataContractJsonSerializer not working with formatted JSON?
At least I tested that the no-whitespace requirement is true as .NET 4. Perhaps this will be changed in a future version to bring it into compliance with the JSON standard?
Tim Goodman May 19 '13 at 14:16 2013-05-19 14:16
source share