In some situations I need to parse an http response having application/json as Content-Type that contains only a quoted string. Here is an example of the raw http response:
HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: application/json; charset=utf-8 Expires: -1 Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 X-Content-Type-Options: nosniff Date: Wed, 28 Nov 2012 18:59:17 GMT Content-Length: 11 "4.22.0007"
Using the new CkJsonObject I am able to Load() the string "4.22.0007", but cannot extract the unquoted string.
I know that this response is non-standard and I could simply remove the quotes manually, since there is anyhow nothing else to be done here. However shouldn't the Load() method fail due to invalid Json ?
In Jansson's Json C library they added an option (JSON_DECODE_ANY) to ignore RFC 4627 and allow loading non-object and non-array single values directly. I am not saying that this is a good workaround though.