📅  最后修改于: 2022-03-11 15:02:50.837000             🧑  作者: Mango
//extensive check to make sure object is not of string type and not null
function isJson(item) {
item = typeof item !== "string"
? JSON.stringify(item)
: item;
try {
item = JSON.parse(item);
} catch (e) {
return false;
}
if (typeof item === "object" && item !== null) {
return true;
}
return false;
}