From 31c067cac59b8ff1a49cd3f71037e31ec2d2feaf Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 29 Apr 2015 15:10:04 -0700 Subject: [PATCH] fix change of keypath after handling array index --- libraries/networking/src/JSONBreakableMarshal.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/JSONBreakableMarshal.cpp b/libraries/networking/src/JSONBreakableMarshal.cpp index 3184abcbb9..176980ffd2 100644 --- a/libraries/networking/src/JSONBreakableMarshal.cpp +++ b/libraries/networking/src/JSONBreakableMarshal.cpp @@ -189,7 +189,12 @@ QVariantMap JSONBreakableMarshal::fromStringList(const QStringList& stringList) currentValue = ¤tList[arrayIndex]; // update the keypath by bumping past the array index - keypath = keypath.mid(keypath.indexOf(']')); + keypath = keypath.mid(keypath.indexOf(']') + 1); + + // check if there is a key after the array index - if so push the keypath forward by a char + if (keypath.startsWith(".")) { + keypath = keypath.mid(1); + } } else { qDebug() << "Failed to convert array index from keypath" << keypath << "to int. Will not add" << "value to resulting QJsonObject.";