forked from bblanchon/ArduinoJson
Added ability to set a nested value like this: root["A"]["B"] = "C"
(issue #352)
This commit is contained in:
@ -67,6 +67,11 @@ inline JsonArraySubscript JsonArray::operator[](size_t index) {
|
||||
return JsonArraySubscript(*this, index);
|
||||
}
|
||||
|
||||
template <typename TImplem>
|
||||
inline JsonArraySubscript JsonVariantBase<TImplem>::operator[](int index) {
|
||||
return asArray()[index];
|
||||
}
|
||||
|
||||
template <typename TImplem>
|
||||
inline const JsonArraySubscript JsonVariantBase<TImplem>::operator[](
|
||||
int index) const {
|
||||
|
@ -71,6 +71,7 @@ class JsonVariantBase : public Internals::JsonPrintable<TImpl> {
|
||||
// Returns the element at specified index if the variant is an array.
|
||||
// Returns JsonVariant::invalid() if the variant is not an array.
|
||||
FORCE_INLINE const JsonArraySubscript operator[](int index) const;
|
||||
FORCE_INLINE JsonArraySubscript operator[](int index);
|
||||
|
||||
// Mimics an object.
|
||||
// Returns the value associated with the specified key if the variant is
|
||||
@ -83,6 +84,13 @@ class JsonVariantBase : public Internals::JsonPrintable<TImpl> {
|
||||
operator[](const TString &key) const {
|
||||
return asObject()[key];
|
||||
}
|
||||
template <typename TString>
|
||||
FORCE_INLINE
|
||||
typename TypeTraits::EnableIf<Internals::StringFuncs<TString>::has_equals,
|
||||
JsonObjectSubscript<TString> >::type
|
||||
operator[](const TString &key) {
|
||||
return asObject()[key];
|
||||
}
|
||||
|
||||
private:
|
||||
const TImpl *impl() const {
|
||||
|
Reference in New Issue
Block a user