diff --git a/JsonGenerator/JsonValue.h b/JsonGenerator/JsonValue.h index d93dc004..ea7fa898 100644 --- a/JsonGenerator/JsonValue.h +++ b/JsonGenerator/JsonValue.h @@ -69,6 +69,11 @@ namespace ArduinoJson return content.asLong; } + operator long() + { + return content.asLong; + } + size_t printTo(Print& p) const { // handmade polymorphism diff --git a/JsonGeneratorTests/JsonValue_Cast_Tests.cpp b/JsonGeneratorTests/JsonValue_Cast_Tests.cpp index 26108a75..72b5dcf1 100644 --- a/JsonGeneratorTests/JsonValue_Cast_Tests.cpp +++ b/JsonGeneratorTests/JsonValue_Cast_Tests.cpp @@ -29,6 +29,10 @@ namespace JsonGeneratorTests setValueAndCheckCast(42); } + TEST_METHOD(Long) + { + setValueAndCheckCast(42L); + } private: