How to Get Parent node path for Child node in Inner JSON structure for Java?

18 views Asked by At

Sample JSON format is like below, need to fetch parent of child node each one step up and at-last have to capture complete path from child node -> top node. Any sample references would be really helpful. Thanks.

{ "title": "P1-main", "A": [ { "title": "P1-A1" }, { "title": "P1-B1", "B": [ { "title": "P1-2" } ] } ] }

Example: Get parent path of child node "P1-2" like below

"P1-2"(its parent title) ---> "P1-B1" (its parent title) ---> "P1-main"

Similarly it could have further "inner" objects also.

Any sample references would be really helpful. Thanks.

0

There are 0 answers