/***** JSON = [{ID: 1}, {ID: 2}] convert "[{ID: 1}, {ID: 2}] "*****/
Jsontostring = function (OBJ ){
If (OBJ = undefined ){
Return "";
}
VaR r = [];
If (typeof OBJ = "string") Return "\" "+ obj. replace (/([\ "\])/g," \ $1 "). replace (/(\ n)/g, "\ n "). replace (/(\ r)/g, "\ r "). replace (/(\ t)/g,
"\ T") + "\"";
If (typeof OBJ = "object "){
If (! OBJ. Sort ){
For (var I in OBJ)
R. Push ("\" "+ I +" \ ":" + Modeler. jsontostring (OBJ [I]);
If (!! Document. All &&! /^ \ N? Function \ s * tostring \ (\) \ s * \ {\ n? \ S * \ [native code \] \ n? \ S * \} \ n? \ S * $/. Test (obj. tostring )){
R. Push ("tostring:" + obj. tostring. tostring ());
}
R = "{" + R. Join () + "}";
} Else {
For (VAR I = 0; I <obj. length; I ++)
R. Push (Modeler. jsontostring (OBJ [I]);
R = "[" + R. Join () + "]";
}
Return R;
}
Return obj. tostring (). Replace (/\ "\:/g ,'":""');
};
Method 2:
REFERENCE The json2.js script and call the JSON. stringify (parameter) method.