Menu

How to check JSON object or JS object is empty?

if (!Object.keys(jsonObj).length === 0) {
    console.log("JSON object have some keys and values");
} else {
    console.log("JSON object is empty");
}


Here jsonObj is JSON or JavaScript object.

No comments:

Post a Comment