I would like to validate JSON coming from an external source. The JSON RFC specifically states, that all strings should be wrapped in double quotes and single quotes are not valid. However, both the built-in JavaScriptSerializer
and Json.NET's JsonConvert.DeserializeObject
accept single quoted strings as valid. Is there a way to tell them not to accept single quoted strings, or is there another library available that validates according to the RFC standard?
Example:
{
"this": "is",
"valid": "json"
}
{
'this': 'is',
'invalid': 'json',
'but': 'parsed',
'correctly': 'by',
'both': 'parsers',
'I': 'mentioned'
}