1//extensive check to make sure object is not of string type and not null
2function isJson(item) {
3 item = typeof item !== "string"
4 ? JSON.stringify(item)
5 : item;
6
7 try {
8 item = JSON.parse(item);
9 } catch (e) {
10 return false;
11 }
12
13 if (typeof item === "object" && item !== null) {
14 return true;
15 }
16
17 return false;
18}