js get all value of json object code example

Example 1: how to get all json object with jsonpath

i would put just empty string  ""

JsonObject -->> ""

Example 2: get all keys in json object

var obj = {name: "Jeeva", age: "22", gender: "Male"}
console.log(Object.keys(obj))

Example 3: json traversal in js

Object.entries(jsonObj).forEach(([key, value]) => {
    // do something with key and val
});

Example 4: json traversal in js

function traverse(jsonObj) {
    if( jsonObj !== null && typeof jsonObj == "object" ) {
        Object.entries(jsonObj).forEach(([key, value]) => {
            // key is either an array index or object key
            traverse(value);
        });
    }
    else {
        // jsonObj is a number or string
    }
}