My problem is using json_pointers correctly, let me explain better by starting to show you a JSon structure:
{
"bar": {
"Qt": "6.8",
"json": "3.11.3",
"array_json": ["/bar/Qt", "/bar/json"]
},
"foo": null
}
< /code>
Хорошо, теперь мой пример кода в этом: < /p>
using json = nlohmann::ordered_json;
// create a json object
json data = R"(
{
"bar": {
"Qt": "6.8",
"json": "3.11.3",
"array_json": ["/bar/Qt", "/bar/json"]
},
"foo": null
}
)"_json;
// get the second element of the "array_json"
QString s_pointer = QString::fromStdString(data["bar"]["array_json"][1].get();
//expected value of pointer = "/bar/json"
qInfo() "/bar/json"
// create a json_pointer
json::json_pointer j_pointer(data["bar"]["array_json"][1].get());
//expected value of json pointer = "/bar/json"
qInfo() "/bar/json"
// get the value of /bar/json using json pointer
QString value = QString::fromStdString(data[j_pointer].get()); // warning here, but its working fine...
qInfo()
Здесь сведения о предупреждении я получил ... < /p>
main.cpp:92:53: 'operator ==' Умерен: с 3.11.2; Используйте Operator == (json_pointer, json_pointer) < /p>
< /blockquote>
p>json.hpp
json.hpp
Подробнее здесь: https://stackoverflow.com/questions/795 ... ated-since
Мобильная версия