Docs: Fix wrong code usage in the Value access section of `json_pointer.md` (#4255)

develop
Fallen_Breath 2024-04-13 20:15:00 +08:00 committed by GitHub
parent 01da82eae2
commit 8c391e04fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -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