1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function Serialize(a) { var s = '{'; if (a instanceof Array) { s = '[' for (var i = 0; i < a.length; i++) { s += Serialize(a[i]) + ','; } if (a.length > 0) { s = s.substring(0, s.length - 1) } return s + ']'; } s = '{'; for (var n in a) { if (a.hasOwnProperty(n)) { s += n + ':\'' + a[n] + '\''; } } return s + '}'; } |
No comments:
Post a Comment