json traversal in js

JavaScript
Object.entries(jsonObj).forEach(([key, value]) => {
    // do something with key and val
});
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
    }
}

Source

Also in JavaScript: