Add containsKey

Benoît Blanchon
2016-12-01 15:12:24 +01:00
parent 9811b15bc3
commit a305102eb0

@@ -36,6 +36,7 @@ Some parts have been simplified to be easier to understand, so if you look at th
- [JsonObject::begin\(\) / JsonObject::end\(\)](#jsonobjectbegin--jsonobjectend)
- [JsonObject::createNestedArray\(\)](#jsonobjectcreatenestedarray)
- [JsonObject::createNestedObject\(\)](#jsonobjectcreatenestedobject)
- [JsonObject::containsKey\(\)](#jsonobjectcontainskey)
- [JsonObject::get\(\)](#jsonobjectget)
- [JsonObject::measureLength\(\)](#jsonobjectmeasurelength)
- [JsonObject::measurePrettyLength\(\)](#jsonobjectmeasureprettylength)
@@ -1000,6 +1001,39 @@ will print
```
### JsonObject::containsKey()
##### Description
Tests if a key exists in the `JsonObject`.
##### Signature
```c++
bool containsKey(const char* key) const;
bool containsKey(const String& key) const;
bool containsKey(const std::string& key) const;
```
##### Arguments
`key`: the key to test.
##### Return value
`true` if the key is present is the `JsonObject`; `false` if not.
##### Example
```c++
StaticJsonBuffer<256> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["city"] = "Paris";
bool hasCity = root.containsKey("city"); // true
bool hasCountry = root.containsKey("country"); // false
```
### JsonObject::get()
##### Description