I have the below JSON string:
var billjson = "({'posts' : [{'Id' :' 7553','Code' :'1186 ','Address' :' GGGG 39Α ','Name' : ' GGGG NAME 3 ','Description' : ' G 3 ','EntrySeason' : ' GGGGG 08-09 ','Period' : ' 10/2009 ','Revenue' : ' 4.10'},{'Id' :' 7553','Code' :'1186 ','Address' :' GGGG 39Α ','Name' : ' FFFF NAME 3 ','Description' : ' F 3 ','EntrySeason' : ' FFFF 08-09 ','Period' : ' 10/2009 ','Revenue' : ' 4.10'}]})"
and I’m trying to create a JSON object using the code:
var mybilljson = jQuery.parseJSON( billjson );
but the result at the console is:
Uncaught Invalid JSON:
Why?
String literals and property names have to use double-quotes in JSON, but you’re using single quotes. The parentheses aren’t allowed to be there either.