0

Afternoon All, I'm using the VBA-TOOLS > JSONConverter from GITHUB. I have it working for the first "layer" or "level" of my JSON string but I cannot get it to drop down a level.

If you look at my example code, the first "level", fields id/createdAt/updatedAt will all show in a simple messagebox. If I try and go down one level to what's within properties, I keep getting the error shown below. I tried two different ways/lines of code, trying to display the value of the first field within properties.

I am passing the code below a JSON string. Here is the data two ways: 1.) This is the raw string

{"id":"448401",
 "properties":{
     "createdate":"2021-11-11T22:28:15.015Z",
     "email":"steven.mcnulty@otis.com",
     "firstname":"Steven",
     "hs_object_id":"448401",
     "lastmodifieddate":"2023-03-31T17:42:31.620Z",
     "lastname":"McNulty"
  },
  "createdAt":"2021-11-11T22:28:15.015Z",
  "updatedAt":"2023-03-31T17:42:31.620Z",
  "archived":false
}

2.) This is a snippet from POSTMAN making the same get request: Postman_Get_request

My code:

Function json_convert(temp As String)

Dim Json As Object
Set Json = JsonConverter.ParseJson(temp)


'WORKING
MsgBox (Json("id"))
MsgBox (Json("createdAt"))


'NOT WORKING
MsgBox (Json("properties")(1)("createdate"))
MsgBox (Json("id")("properties")(1)("createdate"))

End Function

excel_error

These details are above.

Tim Williams
  • 154,628
  • 8
  • 97
  • 125
Steven
  • 1

0 Answers0