0

I am creating an application to store and display multiple hierarchies. I am storing json data in nested tree format like the following

{
  "text":"Node1",
  "children":
      [{
         "text":"Node2",
         "children":[...]
       },
       {
          "text":"Node3",
          "children":[...]
       }]
}

Is there a way to get the distinct values for the field text regardless of where the field appears in hierarchy. It could be the text of the parent, child, grandchild or further descendants.

Desired output is ["Node1","Node2","Node3",...]

0 Answers0