Closed jano42 closed 2 years ago
If this was added natively, how would it distinguish this scenario?:
{
"foo1": "bar",
"foo2": "bar2",
"foo3": {
"sfoo1" : 1,
"sfoo2" : "42"
},
"foo3.sfoo2" : "can't touch me!"
}
Would you expect the user to escape the ".
" before passing it to Boost.Json
? That would be annoying for using string literals and other inputs, not to mention require Boost.Json
to do more work to unescape it it for matching.
Normally for Json-Pointer support, libraries have differently named functions/methods so that they know the argument is a JSON Pointer, or have a lightweight class-type to denote it.
(Also, minor point but that isn't the JSON Pointer syntax - "/foo3/sfoo2
" is, I believe)
JSON Pointer support is a planned feature and it will follow the RFC (avoiding the problems that @hadrielk mentioned).
Implemented in #575
I'm wondering if accessing sub element is a feature that you could implement ?
The idea is to get a direct access to a sub-element like this:
The path separator would be configurable ("." or "/",...)
This is RFC6901, as it's done by rapidjson for example