jeudi 2 avril 2015

json string not parsing

I have to create an abacus as a json string, like this:



var jString = "'rTable':[{'1M=':'70'},{'1mv=':'70'},{'1mx=':'140'},{'1mxv=':'140'},{'1mxx=':'230'},{'1mxxv=':'230'}},{'1m+1':'90'}]";


var rTable = JSON.parse(jString);


When I try to parse it I got an unspecified "syntax error" message. Are special signs like =, + and - allowed? Can someone tell me what is wrong with this json string?


Once created I intend to get the values like this:



var score = "1M=";
var v = rTable[score];


Am I right?


Aucun commentaire:

Enregistrer un commentaire