template<typename KeyT>
iterator find(KeyT && key);
template<typename KeyT>
const_iterator find(KeyT && key) const
Finds an element in a JSON object with key equivalent to key
. If the element is not found or the JSON value is not an
object, end()
is returned.
KeyT
: A type for an object key. This can also be a string literal or a string view (C++17).
key
(in)
: key value of the element to search for.
Iterator to an element with key equivalent to key
. If no such element is found or the JSON value is not an object,
past-the-end (see end()
) iterator is returned.
Strong exception safety: if an exception occurs, the original value stays intact.
Logarithmic in the size of the JSON object.
This method always returns end()
when executed on a JSON type that is not an object.
??? example
The example shows how `find()` is used.
```cpp
--8<-- "examples/find__key_type.cpp"
```
Output:
```json
--8<-- "examples/find__key_type.output"
```
- Added in version 1.0.0.