SAP / gigya-dotnet-sdk

SAP CDC (Gigya) dotnet sdk for server
Apache License 2.0
1 stars 10 forks source link

GSObject class is not functional for objects #22

Open m-pintilie opened 7 months ago

m-pintilie commented 7 months ago

Hi. It seems that the ConstructFromJSONString from GSObject doesn't treat the case when the jsonObject has nodes as an object or as an array. My suggestion is to add this two conditions at the end of the ConstructFromJSONString method : else if ((bool) valueString?.StartsWith("{")) // value itself is a object { Debug.WriteLine(kvp.Key + " : " + valueString); // Create a new GSObject to put as the value of the current key. the source for this child is the current value GSObject child = new GSObject(valueString); this.Put(key, child); } else if ((bool) valueString?.StartsWith("[")) // value itself is a Array { Debug.WriteLine(kvp.Key + " : " + valueString); GSArray childArray = new GSArray(valueString); this.Put(key, childArray); }