Jqstringify is the json.stringify (obj) method implemented using jquery
Code as follows:
<script type= "Text/javascript" src= "/HTTP/ Keleyi.com/keleyi/pmedia/jquery/jquery-1.10.2.min.js "></SCRIPT>
function jqstringify (obj) {
var arr = [];
$.each (obj, function (key, Val) {
var next = key + ":";
Next + = $.isplainobject (val)? Printobj (val): Val;
Arr.push (next);
});
Return "{" + Arr.join (",") + "}";
};
var student = new Object ();
Student.name = "Collayi";
Student.age = "25";
Student.location = "Guangzhou";
var json = json.stringify (student);
Document.writeln (' json.stringify (student) results: ');
Document.writeln (JSON);
var mystringify=jqstringify (student)
Document.writeln (' jqstringify (student) Result: ');
Document.writeln (mystringify)
Executes the result as follows:
Json.stringify (Student) Result: {"name": "Collayi", "Age": "25", " Location ":" Guangzhou "} jqstringify (Student) Result: {name: Collayi, age:25, location: Guangzhou}
The result is the same
JQ implementation Json.stringify (obj) method