VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.76k stars 568 forks source link

Not every "key: value" is in the file so it issues an error #220

Open cityba opened 2 years ago

cityba commented 2 years ago

@timhall Throws an error at dump, these are not everywhere: Type mismatch value-- "accounts":[ "1eb6acd7-2f92-452e-a2e8-e326f86246d7" ],

And "creditorAccount":{ "iban":"HU19117122350745555400000000" }, What is the solution to n be an error?

Nick-vanGemeren commented 2 years ago

You haven't provided the code which gets the error. :{ After ParseJSON, the keys mentioned will each point to a Collection with 1 item (but possibly 0 or more for other queries). The Type mismatch is almost certainly due to missingSet keywords. If the variable dataDictpoints to the level above, code to access the items might look like:

    Dim i, aColl As Collection
    Set aColl = DataDict("accounts")
    For i = 1 To aColl.Count
        Debug.Print aColl(i)
      Next