jqueryajaxjsonvalidationjsonlint

Why is the JSON that flot expects no longer valid in JSONLint (and hence jQuery 1.4.x)?


Attempting to use the data series from this example no longer passes the JSONLint test. and as such attempting to use it with jQuery 1.4 fails. Specifically, returning it or data like it from an AJAX request as type json will cause jQuery to throw an error. I know this worked perfectly well with jQuery 1.3.x. Does anyone have a solution?


Solution

  • The problem is that that pseudo-JSON doesn't quote object keys:

     // right
     { "something": "value" }
     // wrong
     { something: "value" }
    

    It's OK to do that in Javascript, but JSON syntax is stricter than Javascript syntax.