To produce navigable trees from any Javascript object, use π°πΌπ»ππΌπΉπ².π±πΆπΏ. You will get an interactive list of all object properties.
One nice thing about this method is that it can handle DOM elements too. So instead of getting the original HTML elements, you get a JSON representation of the object, as you can see in the snap below how different the document object looks with π°πΌπ»ππΌπΉπ².π±πΆπΏ as opposed to π°πΌπ»ππΌπΉπ².πΉπΌπ΄.
It takes a second object parameter with these options:
1- π±π²π½ππ΅ => set it to null if you want to cover all levels recursively.
2- π°πΌπΉπΌπΏπ
3- ππ΅πΌπππΆπ±π±π²π» => shows non-enumerable keys and Symbols.
If you have an XML/HTML element, then use π°πΌπ»ππΌπΉπ².π±πΆπΏπ πΊπΉ instead.
Note that you could also use π±πΆπΏ and π±πΆπΏπ πΊπΉ directly without the need for the π°πΌπ»ππΌπΉπ² object.
Follow for more tips :)
Top comments (0)