diff --git a/code/foundation/io/jsonreader.cc b/code/foundation/io/jsonreader.cc index 23ee98116..0feb62144 100644 --- a/code/foundation/io/jsonreader.cc +++ b/code/foundation/io/jsonreader.cc @@ -323,6 +323,19 @@ JsonReader::GetChildNodeName(SizeT childIndex) return ""; } +//------------------------------------------------------------------------------ +/** + +*/ +bool +JsonReader::IsString() const +{ + n_assert(this->IsOpen()); + n_assert(0 != this->curNode); + return this->curNode->is_string(); +} + + //------------------------------------------------------------------------------ /** diff --git a/code/foundation/io/jsonreader.h b/code/foundation/io/jsonreader.h index bd77ddcf6..da511f4bc 100644 --- a/code/foundation/io/jsonreader.h +++ b/code/foundation/io/jsonreader.h @@ -60,6 +60,8 @@ class JsonReader : public StreamReader /// gets the childname of the child at index, or empty string if no child exists or has no name. Util::String GetChildNodeName(SizeT childIndex); + /// check if current node is a string + bool IsString() const; /// check if current node is an array bool IsArray() const; /// check if current node is an object (can have keys) diff --git a/toolkit/toolkit-common/projectinfo.cc b/toolkit/toolkit-common/projectinfo.cc index b038ea8ef..30f04475f 100644 --- a/toolkit/toolkit-common/projectinfo.cc +++ b/toolkit/toolkit-common/projectinfo.cc @@ -200,11 +200,8 @@ ProjectInfo::ParseProjectInfoFile(const IO::URI & path) if (jsonReader->SetToFirstChild()) do { - if (!jsonReader->HasChildren()) - { - this->attrs.Add(jsonReader->GetCurrentNodeName(), jsonReader->GetString()); - } - else + String thing = jsonReader->GetCurrentNodeName(); + if (jsonReader->HasChildren()) { String currentKey = jsonReader->GetCurrentNodeName(); Dictionary values; @@ -216,6 +213,10 @@ ProjectInfo::ParseProjectInfoFile(const IO::URI & path) while (jsonReader->SetToNextChild()); this->listAttrs.Add(currentKey, values); } + else if (jsonReader->IsString()) + { + this->attrs.Add(jsonReader->GetCurrentNodeName(), jsonReader->GetString()); + } } while (jsonReader->SetToNextChild()); return Success;