login about faq

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


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.

asked Mar 15 '16 at 10:25

roan98dk's gravatar image


Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Mar 15 '16 at 10:25

Seen: 1,044 times

Last updated: Mar 15 '16 at 10:25

powered by OSQA