Resolved: make object structure recursive structure with same keys in javascript

In this post, we will see how to resolve make object structure recursive structure with same keys in javascript

Question:

Currently, I have this object


What I want is..


In this situation, how can I make the structure recursively? I’ve read the lodash library document but I couldn’t find a good combination to handle this issue.
Can I get any hint for this?

Best Answer:

You can create recursive function and run it again if value is object, or set path if it is string. Check inline comments:


If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com