mirror of
https://github.com/nlohmann/json.git
synced 2026-07-12 05:25:09 +00:00
@@ -17,6 +17,8 @@ ValueType value(const json_pointer& ptr,
|
|||||||
const ValueType& default_value) const;
|
const ValueType& default_value) const;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This is equivalent to Python's `dict.get(key, default)`.
|
||||||
|
|
||||||
1. Returns either a copy of an object's element at the specified key `key` or a given default value if no element with
|
1. Returns either a copy of an object's element at the specified key `key` or a given default value if no element with
|
||||||
key `key` exists.
|
key `key` exists.
|
||||||
|
|
||||||
@@ -50,10 +52,6 @@ ValueType value(const json_pointer& ptr,
|
|||||||
- Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by
|
- Unlike [`operator[]`](operator[].md), this function does not implicitly add an element to the position defined by
|
||||||
`key`/`ptr` key. This function is furthermore also applicable to const objects.
|
`key`/`ptr` key. This function is furthermore also applicable to const objects.
|
||||||
|
|
||||||
!!! note
|
|
||||||
|
|
||||||
This is equivalent to Python's `dict.get(key, default)`.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
`KeyType`
|
`KeyType`
|
||||||
|
|||||||
Reference in New Issue
Block a user