Is this really JSON?

{"something":"1","mode":"true","number":"1234"}

Because I get 406 pending JSON.

It is generated through Jersey, which is informed that the @Produces method is JSON. It is adopted by Dojo xhrGet, which has JSON as its handleAs.

EDIT. To clarify, I'm not interested in the code I'm evaluating, or something like that. The question was very simple - is it really JSON?

+5
source share
5 answers

This is true, but you use both boolean ( mode) and numeric ( number) as strings . Must not be:

{"something":"1","mode":true,"number":1234}
+14
source

Indeed, JSON if all dictionary values ​​are strings. This is also true JSON:

{ "something": 1, "mode": true, "number": 1234}

, , 406, (, html json), . , , ?

+7

/ JASONLint (http://www.jsonlint.com/), JSON. .

+6

, . JSON, , :

{ "-": 1, "": "", "": 1234}

, .

EDIT: Eh... , , - .

+1
  • , JSON
  • although if you plan to output this as a result of an HTTP request, you will need to avoid all quotes

$ str = "{\" something \ ": \" 1 \ ", \" mode \ ": \" true \ ", \" number \ ": \" 1234 \ "}"; echo $ str

0
source

All Articles