FastLED 3.10.8
Loading...
Searching...
No Matches

◆ operator[]() [1/4]

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

Definition at line 773 of file json.h.

775 {
776 if (!mValue || !mValue->is_object()) {
777 return json(nullptr);
778 }
779 // Use ptr<> directly to avoid copying the entire map via as_object().
780 // The variant stores json_object (not const), so use ptr<json_object>().
781 // The const overload of ptr<T>() returns const T*, which is what we want.
782 auto objPtr = mValue->data.ptr<json_object>();
783 if (!objPtr) return json(nullptr);
784 auto it = objPtr->find(key);
785 if (it != objPtr->end()) {
786 return json(it->second);
787 }
fl::shared_ptr< json_value > mValue
Definition json.h:263
json() FL_NO_EXCEPT
Definition json.h:267
fl::flat_map< fl::string, fl::shared_ptr< json_value >, fl::StringFastLess > json_object
Definition types.h:55