Praticamente questa funzione che mi stai dicendo non avrebbe bisogno di includere un framework?
Penso che tu ti riferisca a questa:
codice:
// implement JSON.stringify serialization
JSON.stringify = JSON.stringify || function (obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string") obj = '"'+obj+'"';
return String(obj);
}
else {
// recurse array or object
var n, v, json = [], arr = (obj && obj.constructor == Array);
for (n in obj) {
v = obj[n]; t = typeof(v);
if (t == "string") v = '"'+v+'"';
else if (t == "object" && v !== null) v = JSON.stringify(v);
json.push((arr ? "" : '"' + n + '":') + String(v));
}
return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
};
Ma scusate l'ignoranza Json è fondamentale per questa cosa o nel metodo che dicevo io è lo stesso?
Sicuramente da quanto sto vedendo mi sembra molto più comoda però vorrei capire bene la differenza tra fattibilità-difficoltà..