1

Given a Value in a RapidJSON document, is it possible to easily find that Value's parent?

Specifically, we're using Pointer to find a value, but we then want to move back up one level to find that value's parent.

I was hoping there would be an easily available GetParent() or even a Pointer statement that would move me up one level, but so far I haven't found it.

All I've come up with is to then iterate through the entire tree, checking child items until I find it. I haven't tried to do that yet, but presumably it's possible (but wildly inefficient).

Help?

Doug Porter
  • 198
  • 12

1 Answers1

1

Turns out this is dead simple and I'd missed it in reading the JSON Pointer docs. To move up one level from a particular point:

1

So to move up one level and then descend into a branch named "Foods":

1/Foods

To move up two levels and then descend into a branch named "Simple":

2/Simple
Doug Porter
  • 198
  • 12
  • Turns out the reason I had such trouble making this work was... RapidJson doesn't seem to support relative pointers. – Doug Porter Oct 07 '20 at 19:02