1# basic_json::find 2 3```cpp 4template<typename KeyT> 5iterator find(KeyT&& key); 6 7template<typename KeyT> 8const_iterator find(KeyT&& key) const 9``` 10 11Finds an element in a JSON object with key equivalent to `key`. If the element is not found or the JSON value is not an 12object, `end()` is returned. 13 14## Template parameters 15 16`KeyT` 17: A type for an object key. 18 19## Parameters 20 21`key` (in) 22: key value of the element to search for. 23 24## Return value 25 26Iterator to an element with key equivalent to `key`. If no such element is found or the JSON value is not an object, 27past-the-end (see `end()`) iterator is returned. 28 29## Exception safety 30 31Strong exception safety: if an exception occurs, the original value stays intact. 32 33## Complexity 34 35Logarithmic in the size of the JSON object. 36 37## Notes 38 39This method always returns `end()` when executed on a JSON type that is not an object. 40 41## Example 42 43??? example 44 45 The example shows how `find()` is used. 46 47 ```cpp 48 --8<-- "examples/find__key_type.cpp" 49 ``` 50 51 Output: 52 53 ```json 54 --8<-- "examples/find__key_type.output" 55 ``` 56 57## Version history 58 59- Added in version 1.0.0. 60