I am parsing a JSON object in VBA. I found a code example on this forum that works great. However, one of the fields in the object is "total". in my code, I am trying to get the total, but "total" is being switched to "Total". I get an error 438 at runtime. Here is the code snipit:
Dim Issues As Object
Dim scriptControl As Object
Set scriptControl = CreateObject("MSScriptControl.ScriptControl")
scriptControl.Language = "JScript"
Set ObjHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "http://<url>.com:10005/rest/api/2/search"
ObjHTTP.Open "POST", URL, False
ObjHTTP.SetRequestHeader "Authorization", "Basic <userid / password>"
ObjHTTP.SetRequestHeader "Content-Type", "application/json"
'Get the new work intake for the month.
ObjHTTP.send ("{""jql"":""<my query here>"":[""id""],""maxResults"":1}")
strX = ObjHTTP.responsetext
Set Issues = scriptControl.Eval("(" + strX + ")")
With Sheets("Test")
.Cells(1, 1) = Issues.expand --this works
.Cells(1, 2) = Issues.startAt --this works
.Cells(1, 3) = Issues.maxResults -- this works
.Cells(1, 4) = Issues.Total -- JSON object is "total" editor keeps switching to "Total"
End With
Does anyone know why I cannot use Issues.total?