File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,14 @@ void demoCreation() {
78
78
79
79
myObject[" hello" ] = " world" ;
80
80
myObject[" true" ] = true ;
81
- myObject[" x" ] = 42 ;
81
+
82
+ myObject[" x1" ] = (int ) 42 ;
83
+ myObject[" x2" ] = (long ) 42 ;
84
+ myObject[" x3" ] = (unsigned long ) 42 ;
85
+
86
+ int x1 = myObject[" x1" ];
87
+ long x2 = myObject[" x2" ];
88
+ unsigned long x3 = myObject[" x3" ];
82
89
83
90
Serial.print (" myObject.keys() = " );
84
91
Serial.println (myObject.keys ());
Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ JSONVar::operator long() const
142
142
return cJSON_IsNumber (_json) ? _json->valueint : 0 ;
143
143
}
144
144
145
+ JSONVar::operator unsigned long () const
146
+ {
147
+ return cJSON_IsNumber (_json) ? _json->valueint : 0 ;
148
+ }
149
+
145
150
JSONVar::operator double () const
146
151
{
147
152
return cJSON_IsNumber (_json) ? _json->valuedouble : NAN;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class JSONVar : public Printable {
49
49
operator bool () const ;
50
50
operator int () const ;
51
51
operator long () const ;
52
+ operator unsigned long () const ;
52
53
operator double () const ;
53
54
operator const char *() const ;
54
55
You can’t perform that action at this time.
0 commit comments