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

◆ operator[]() [1/4]

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

Definition at line 608 of file json.h.

610 {
611 if (!mValue || !mValue->is_object()) {
612 return json(nullptr);
613 }
614 // Use ptr<> directly to avoid copying the entire map via as_object().
615 // The variant stores json_object (not const), so use ptr<json_object>().
616 // The const overload of ptr<T>() returns const T*, which is what we want.
617 auto objPtr = mValue->data.ptr<json_object>();
618 if (!objPtr) return json(nullptr);
619 auto it = objPtr->find(key);
620 if (it != objPtr->end()) {
621 return json(it->second);
622 }
json() FL_NOEXCEPT
Definition json.h:134
fl::shared_ptr< json_value > mValue
Definition json.h:130
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
Definition types.h:34