FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator[]() [1/2]

JsonValue & fl::JsonValue::operator[] ( const fl::string & key)
inline

Definition at line 1404 of file json.h.

1406 {
1407 if (!is_object()) data = JsonObject{};
1408 auto ptr = data.ptr<JsonObject>();
1409 if (!ptr) return get_null_value(); // Handle error case
1410 auto &obj = *ptr;
1411 if (obj.find(key) == obj.end()) {
1412 // Create a new entry if key doesn't exist
1413 obj[key] = fl::make_shared<JsonValue>();
1414 }
shared_ptr< T > make_shared(Args &&... args)
Definition shared_ptr.h:348
fl::HashMap< fl::string, fl::shared_ptr< JsonValue > > JsonObject
Definition json.h:171
FL_DISABLE_WARNING_POP JsonValue & get_null_value()
Definition json.cpp:70
bool is_object() const noexcept
Definition json.h:879
variant_t data
Definition json.h:678