• No parsing of an empty JSONObject

    By Peter Steibert 7 years ago

    I have tried to parse the folllowing JSON-String with the JSONReader.

    {"cells":[{"type":"basic.Circle","size":{"width":60,"height":60},"position":{"x":360,"y":440},"angle":0,"name":"newstart","id":"024894fa-5059-44cf-a26a-206a94554407","z":1,"attrs":{}}]}
    

    After several attempts I discovered that attrs”:{} leads to an error while parsing. So I examined the source code. In my opinion the fault is located in the functions CreateJSONObject and ParseMe in the class JSONReader.

    Unfortunately, I donĀ“t exactly know how to change the code and so I look forward to your help.

    • By Samuel Flint 5 years ago

      I have located where it fails and resolved the issue.

      I added to JSONReader the following function

      Private Function JSONSet(obj, inobj)

      If IsObject(inobj) Then Set obj = inobj
      If Not IsObject(inobj) Then obj = inobj 
      

      End Function

      Then I used this at

      CreateJSONObject line 266

      Before: vkey = me.ParseMe
      After: JSONSet vkey, me.ParseMe