-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
solution: duplicatethe issue is a duplicate; refer to the linked issue insteadthe issue is a duplicate; refer to the linked issue insteadsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Hi,
I think i hit a bug in json_pointer construction with nlohmann::json 3.7.0.
When i call json.contains with "/objects/account/actions/select"_json_pointer it works perfect, but calling it with already constructed json_pointer gives false result.
Here is how to reproduce:
#include "json.hpp"
#include <iostream>
int main() {
nlohmann::json test;
test["objects"]["account"]["actions"]["select"]=65;
std::string jsonp="/objects/account/actions/select";
nlohmann::json::json_pointer jp(jsonp);
std::cout << test << std::endl;
std::cout << "Is it found with "<< jp<< " : " << test.contains(jp) << std::endl;
std::cout << "Is it found now: " << test.contains("/objects/account/actions/select"_json_pointer) << std::endl;
return 0;
}Output of this is:
{"objects":{"account":{"actions":{"select":65}}}}
Is it found with "/objects/account/actions/select" : 0
Is it found now: 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
solution: duplicatethe issue is a duplicate; refer to the linked issue insteadthe issue is a duplicate; refer to the linked issue insteadsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation