Menu

Showing posts with label How to check JSON object of JS object is empty?. Show all posts
Showing posts with label How to check JSON object of JS object is empty?. Show all posts

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.