#includeDynamicJsonDocument doc(1024); deserializeJson(doc, "{\"temperature\": 25}"); int temp = doc["temperature"].get (); Serial.print("Temperature: "); Serial.println(temp);
#includeIn this example, we create a StaticJsonDocument object and set the humidity value to 50. We then use the as() method to retrieve the value and assign it to the hum variable. Finally, we print out the humidity value. Overall, the JsonObject.get_int() method is used to retrieve integer values from a JSON object, and it is a part of the ArduinoJson library.StaticJsonDocument<200> doc; doc["humidity"] = 50; int hum = doc["humidity"].as (); Serial.print("Humidity: "); Serial.println(hum);