I have used below code to parse WinHttpRequest responseText using JsonConverter. Below is my code and response.
Sub getAuthToken(row As Integer, col As Integer, vin As String)
Dim URL,JsonString As String
Dim objHTTP As New WinHttpRequest
Dim Parsed As Dictionary
URL = "http://webex.com/userlogin/validate"
objHTTP.Open "POST", URL, False
objHTTP.SetRequestHeader "Content-Type", "application/json"
JsonString = "{""emailId"":""****"",""passWord"":""*****""}"
objHTTP.Send JsonString
Set Parsed = JsonConverter.ParseJson(JsonConverter.ConvertToJson(objHTTP.ResponseText))
End Sub
Response: [{ "employeeId": 999, "userId": ..... }] Getting error at the last line of Parsed -
Its clear that the response not in the format JsonCoverter package is expecting. But do i need to do reformat before ParseJson?
When i update the code as below
Dim JSONa As Object
Set JSONa = JsonConverter.ParseJson(objHTTP.ResponseText)
it works, but how should iterate this object to get my response values? Attached the response structure
I have used below code to parse WinHttpRequest responseText using JsonConverter. Below is my code and response.
Response: [{ "employeeId": 999, "userId": ..... }] Getting error at the last line of Parsed -
"Run-time error '1001': Error parsing JSON: "[{"employe, expecting '{' or '['"
Its clear that the response not in the format JsonCoverter package is expecting. But do i need to do reformat before ParseJson? When i update the code as below Dim JSONa As Object Set JSONa = JsonConverter.ParseJson(objHTTP.ResponseText) it works, but how should iterate this object to get my response values? Attached the response structure