"Determine if JSON is empty"
var jsonstr ={};
1. Determine if the JSON is empty
Jquery.isemptyobject ();
2. Determine if the object is empty:
1, if (typeOf (x) = = "undefined")
2, if (TYPEOF (x)! = "Object")
3. if (!x)
The third is the simplest method, but the third one can not be used if (x) this mutually exclusive method to judge, only in front of the object to add!
3. The key of JSON cannot be duplicated;
jsonstr[key]= "XXX", which exists in substitution, does not exist is added.
4. Traverse JSON
for (var key in Jsonstr) {
Alert (key+ "" +jsonstr[key])
}
" determines whether the return JSON format "
Isjson = function (obj) {var Isjson = typeof (obj) = = "Object" && Object.prototype.toString.call (obj). toLowerCase () = = "[Object Object]" &&!obj.length; return Isjson;} if (!isjson data) data = eval (' (' +data+ ') ');//convert string to JSON format
Summary of JSON judgments in
JS (continuous finishing)