-
-
Notifications
You must be signed in to change notification settings - Fork 191
Closed
Labels
Description
Describe the bug
using jsonpath and jsonpointer to query same array item in the same json
get same result
One more bracket in result of jsonpath query
result of jsonpointer query is right.
Enumerate the steps to reproduce the bug
store.json
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees 尼格尔 内斯",
"title": "Sayings of the Century",
"price": 8.95
}
]
}
}result of jsonpath query
[[
{ "category": "reference",
"author": "Nigel Rees 尼格尔 内斯",
"title": "Sayings of the Century",
"price": 8.95
}
]]result of jsonpointer query
[
{ "category": "reference",
"author": "Nigel Rees 尼格尔 内斯",
"title": "Sayings of the Century",
"price": 8.95
}
]Include a small, self-contained example if possible
std::ifstream is("store.json");
auto g_json = json::parse(is);
json result;
std::string cond = "/store/book"; // jsonpointer;
// std::string cond = "$.store.book"; // jsonpath
if (cond[0] == '$') { // jsonpath;
result = json_query(g_json, cond);
}
else if (cond[0] == '/') { // jsonpointer;
std::error_code ec;
result = jsonptr::get(g_json, cond, ec);
if (ec) {
std::cout << ec.message() << '\n';
}
else {
std::cout << "(2) " << result << '\n';
}
}What compiler, architecture, and operating system?
- Compiler: MSVC(Visual Studio 2019)
- Architecture (e.g. x86, x64) : x86
- Operating system: Windows 10
What jsoncons library version?
- Latest release 1.0.0
- Other release ______
- [ - ] master