#Most efficient way to search for child parameters (recursive find?) #1141
Labels
kind: question
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Hello All-
I have an application where I have a hierarchical set of JSON objects. Meaning that I have objects that in turn have child JSON objects and so on. I need to have the ability to allow the user to query the value of one of the objects using something akin to a file path. For example, example if my JSON object looks like:
I want to provide a method that will return the value of any parameter by passing a 'path' to the parameter. Using the example above, if I wanted the value of the parameter "Child2", I could request it using the path 'Child/Child2', which would return the value 2. I have it working with the code below:
However I suspect that this is inefficient because I am creating a copy of the parameters as I traverse the tree. I have also thought about iterators and pointers, but thought I would reach out to the community to to see if anyone has already solved this problem, hopefully in a more efficient manor.
Any suggestions?
Thanks!
Jim
The text was updated successfully, but these errors were encountered: