<script type = "text/javaScript">/*** เอาต์พุตวัตถุ JS ใด ๆ เป็นสตริงรูปแบบ JSON* @param {Object} _OBJ: วัตถุที่ต้องเป็นเอาต์พุตเป็นสตริง*/var obj2string = function (_obj) {var t = typeof (_obj); if (t! = 'Object' || _obj === null) {// ประเภทข้อมูลง่าย ๆ ถ้า (t == 'สตริง') {_obj = '' ' + _obj +' ''; } return String (_OBJ); } else {if (_OBJ Instanceof Date) {return _obj.tolocalestring (); } // recurse array หรือ object var n, v, json = [], arr = (_obj && _obj.constructor == array); สำหรับ (n ใน _obj) {v = _obj [n]; t = typeof (v); if (t == 'string') {v = '' ' + v +' '' '; } อื่นถ้า (t == "object" && v! == null) {v = this.obj2string (v); } json.push ((arr? '': '' ' + n +' ": ') + สตริง (v)); } return (arr? '[': '{') + สตริง (json) + (arr? ']': '}'); - var obj = {"result": {"fs": {"tsp.ibr.mirror": [{"_value": "1.0", "_class": 4}], "tsp.ibr.get_fnames": [{"_value": "0.0" "_value": "0.0", "_class": 4}], "tsp.ibr.info": [{"_value": "0.0", "_class": 4}]}}, "iscanceled": เท็จ "e": "" "รหัส": 0, "requid": "xxxx-xxxxxxxx-xxxxx-6c2f17bb-ea18-42ec-98fa-3f63b8d26aba-nd-rq", "เวอร์ชัน": "1.0" "Down", "Nodetime": 1362462128706, "Iskecompressed": False, "SEQ": 2} Alert (OBJ2STRING (OBJ)) </script>