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

◆ operator[]() [1/2]

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

Definition at line 1405 of file types.h.

1405 {
1406 if (!is_object()) data = json_object{};
1407 auto ptr = data.ptr<json_object>();
1408 if (!ptr) return get_null_json_value(); // Handle error case
1409 auto &obj = *ptr;
1410 if (obj.find(key) == obj.end()) {
1411 // Create a new entry if key doesn't exist
1412 obj[key] = fl::make_shared<json_value>();
1413 }
1414 return *obj[key];
1415 }
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414
json_value & get_null_json_value()
Definition json.cpp.hpp:64
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
Definition types.h:34
variant_t data
Definition types.h:700
bool is_object() const FL_NOEXCEPT
Definition types.h:906

References json_value(), data, FL_NOEXCEPT, fl::get_null_json_value(), is_object(), and fl::make_shared().

+ Here is the call graph for this function: