// obj["4"]["3"] this causes the problems
That is invalid because QVariant
does not have an operator[] overload. That is also what the compiler is trying to tell you with this:
no match for 'operator[]' (operand types are 'QVariant' and 'const char [2]') QVariant/QVariantMap
You will need to convert any nested QVariant explicitly to QVariantMap if that is the underlying data type. See the following method for details:
QMap QVariant::toMap() const
Returns the variant as a QMap if the variant has type() QMetaType::QVariantMap; otherwise returns an empty map.
It is not the main point, but you also have two further issues:
You seem to use the word Varient as opposed to Variant.
Your code lacks error checking and reporting for conversions, etc.