Skip to content
Advertisement

Loop through a nested JSON object

I’m looking for a solution to loop through a nested JSON object in pure JS. Indeed I’d like to console.log every item and each of its properties.

JavaScript

Advertisement

Answer

You are accessing an object’s value using its key in json_object[item] so just keep drilling down into the object.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement