<script type = "text / javascript"> / ** * sortir de l'objet JS comme une chaîne de format JSON * @param {objet} _obj: objet qui doit être sorti sous forme de chaîne * / var obj2String = function (_obj) {var t = typeof (_OBJ); if (t! = 'objet' || _obj === NULL) {// Type de données simple if (t == 'String') {_OBJ = '"' + _OBJ + '"'; } return String (_obj); } else {if (_obj instanceof date) {return _obj.tolocalestring (); } // Récusant Array ou objet var n, v, json = [], arr = (_obj && _obj.constructor == array); pour (n dans _obj) {v = _obj [n]; t = typeof (v); if (t == 'string') {v = '"' + v + '"'; } else if (t == "objet" && v! == null) {v = this.obj2string (v); } json.push ((arr? '': '"' + n + '":') + string (v)); } return (arr? '[': '{') + String (json) + (arr? ']': '}'); }}; var obj = {"result": {"fs": {"tsp.ibr.mirror": [{"_value": "1.0", "_class": 4}], "tsp.ibr.get_fnames": [{"_value": "0.0", "_class": 4}], "tsp.ibr.get_id" _class ": 4}]" "_value": "0.0", "_class": 4}], "tsp.ibr.info": [{"_value": "0.0", "_class": 4}]}}, "iscanceled": false, "e": "", "isRespesed": true, "aoqSize": 0, "estaSyNCe "Code": 0, "requid": "xxxx-xxxxxx-xxxxx-6c2f17bb-ea18-42ec-98fa-3f63b8d26aba-nd-rq", "version": "1.0", "fname": "tsp.ibr.get_fname", "Message": "4 fonctions ont obtenu" TSP.ibr.get_fnoms "," Message ":" 4 fonctions ont réussi ",", diritora ",": ":" Fonctions a été réussi ",", diritora ",": ": 4 fonctions ont réussi". "Down", "nodetime": 1362462128706, "isKeyCompressed": false, "seq": 2} alert (obj2string (obj)) </cript>