-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inserting in unordered json using a pointer retains the leading slash #2958
Comments
The reason for this behavior is that you use a ojson test2;
test2[json_pointer(p)] = json::object(); There are two overloads for You can fix this by changing the type of the JSON Pointer in the second example: ojson test2;
test2[ojson::json_pointer(p)] = json::object(); |
Thanks for the explanation about the overloads! I switched to using |
* Make exception context optional Change exception context parameter to pointer and replace context with nullptr where appropriate. * Support escaping other string types * Add string concatenation function Add variadic concat() function for concatenating char *, char, and string types. * Replace string concatenations using + with concat() * Template json_pointer on string type Change json_pointer from being templated on basic_json to being templated on string type. * Add unit test for #3388 Closes #3388. * Fix regression test for #2958 * Add backwards compatibility with json_pointer<basic_json> * Update json_pointer docs * Allow comparing different json_pointers * Update version numbers
What is the issue you have?
Inserting a node in an unordered json object using a pointer retains the leading slash
Please describe the steps to reproduce the issue.
I am using the single json.hpp file
Can you provide a small but working code example?
I also tested with
"/root"_json_pointer
instead ofjson_pointer(p)
and I get the same behaviour.What is the expected behavior?
Output from the code above:
And what is the actual behavior instead?
I expect both outputs to be the same, without the leading forward slash:
Which compiler and operating system are you using?
Which version of the library did you use?
develop
branchIf you experience a compilation error: can you compile and run the unit tests?
Not a compilation error.
The text was updated successfully, but these errors were encountered: