Tencent / rapidjson

A fast JSON parser/generator for C++ with both SAX/DOM style API
http://rapidjson.org/
Other
14.2k stars 3.53k forks source link

Get JSON pointer from any value #2005

Open mobalu opened 2 years ago

mobalu commented 2 years ago

I need to compare the structural integrity of multiple JSON files. For that I need a common identifier for any type of value (array, object, iterator, ...). I think JSON pointers could do the trick.

But, in the rapidJSON doc I could not find a function that returns a JSON pointer, only the other way around (value from pointer).

What I would like to do:

  1. multiple JSON files should have the same structure
  2. i iterate over one of the file's members (with member iterator)
  3. then I would like to check the existence of that member in all other files by JSON pointer => but how to get the pointer?

Thanks for helping!

mobalu commented 2 years ago

Just came across JSON schema, which I think would do the trick as well, at least partially.

But I am still looking for a way to get a JSON pointer from any JSON value or iterator.

If this is not possible I would like to see this feature in the future.