You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better version that reads the object properties and makes into a table with headers:
Option Explicit
Public Sub IterateOverACollection()
Dim jsonString As String
jsonString = "[{""row"":1, ""a"":""0007"", ""b"":""Blue"", ""c"":""2008""}, {""row"":2, ""a"":null, ""b"":"""", ""c"":""1709""}]"
Dim myCollection As Collection
Set myCollection = ParseJson(jsonString)
Dim myDictionary As Dictionary
Dim i As Long, j As Long
Dim StartCell As Range
Set StartCell = ActiveSheet.Range("A1")
Set myDictionary = myCollection(1)
For j = 1 To myDictionary.Count
StartCell.Offset(0, j - 1) = myDictionary.Keys(j - 1)
StartCell.Offset(0, j - 1).Font.Bold = True
Next j
For i = 1 To myCollection.Count
Set myDictionary = myCollection(i)
For j = 1 To myDictionary.Count
StartCell.Offset(i, j - 1) = myDictionary.Items(j - 1)
Next j
Next i
End Sub
Hi, I have tried the routine with this Json but I get error in "line":5 I think it is because of the array "failure_reason":{"type": "validation", "fields":["email"]},
could you help me on this?
thank you very much in advance
{"line":5, "email": "institutcastelldelquer @gmail. com", "sms_phone":null, "result": "failure", "failure_reason":{"type": "validation", "fields":["email"]} the full json is this[{"line":1, "email":"", "sms_phone":null, "result": "failure", "failure_reason": "header", "created_at": "2024-02-13T11:01:19:000Z"},
Originally posted by @zgrose in #329 (comment)
The text was updated successfully, but these errors were encountered: