Let's say I have a JSON object like
var myjson = {
"com.mycompany.top.Element" : {
"com.mycompany.top.count" : 10,
"com.mycompany.top.size" : 0
....
}
};
And I want to replace the dots/periods in the keys with a colon so the JSON becomes:
var myjson = {
"com:mycompany:top:Element" : {
"com:mycompany:top:count" : 10,
"com:mycompany:top:size" : 0
....
}
};
The JSON2 from Doublos Crockford just replaces the values not keys. Wondered if anybody else hade written a regexp or parser to replace the text making up the key?