mirror of
https://github.com/nlohmann/json.git
synced 2024-11-27 16:49:02 +08:00
Docs: Fix wrong code usage in the Value access section of json_pointer.md
(#4255)
This commit is contained in:
parent
01da82eae2
commit
8c391e04fe
@ -71,10 +71,10 @@ auto j = json::parse(R"({
|
||||
})");
|
||||
|
||||
// access values
|
||||
auto val = j["/"_json_pointer]; // {"array":["A","B","C"],...}
|
||||
auto val = j[""_json_pointer]; // {"array":["A","B","C"],...}
|
||||
auto val1 = j["/nested/one"_json_pointer]; // 1
|
||||
auto val2 = j.at[json::json_pointer("/nested/three/1")]; // false
|
||||
auto val3 = j.value[json::json_pointer("/nested/four", 0)]; // 0
|
||||
auto val2 = j.at(json::json_pointer("/nested/three/1")); // false
|
||||
auto val3 = j.value(json::json_pointer("/nested/four"), 0); // 0
|
||||
```
|
||||
|
||||
## Flatten / unflatten
|
||||
|
Loading…
Reference in New Issue
Block a user