- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
function fixMootoolsJSON(thing) {
var i, member, pattern = /^"\[.*\]"$/, copy;
if (thing instanceof Array) {
for (i = 0; i < thing.length; i++) {
member = thing[i];
if (typeof member == "string" && pattern.test(member)) {
thing[i] = fixMootoolsJSON(JSON.decode(member));
}
}
} else if (typeof thing == "object") {
copy = { };
for (i in thing) {
if (thing.hasOwnProperty(i)) {
copy[i] = fixMootoolsJSON(JSON.decode(thing[i]));
}
}
for (i in copy) {
if (copy.hasOwnProperty(i)) {
thing[i] = copy[i];
}
}
}
return thing;
}
Комментарии (1) RSS