Issue with recursive iteration and arrays #4318
Unanswered
CJCombrink
asked this question in
Q&A
Replies: 2 comments
-
It looks like only the iterators into the collection returned by |
Beta Was this translation helpful? Give feedback.
0 replies
-
Slightly uglier than what I had hoped, but here's a working version iterating over |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to recursively iterate a JSON Object but seem to have issues with an array.
I have code sort of based on this code on Stack Overflow: https://stackoverflow.com/a/73323420/991000
I started with the code posted on the same question from @nlohmann but I need the full paths (
json_pointers
) to the elements.The issue is that inside the recursive function when I call
it.key
I get the following runtime exception:From my understanding from the docs the
it.key()
function is supposed to give me the array index, from the note:See my example on compiler explorer: https://godbolt.org/z/Yr8jdhqoc
Am I doing anything wrong or how would I get this to work as expected.
Or is this a bug?
I am using
nlohmann_json/3.11.2
Beta Was this translation helpful? Give feedback.
All reactions