LoadJSON confusion on my part.
Posted: Fri Dec 28, 2018 5:36 pm
The PB help text for LoadJSON() does not have an example of it anywhere in the system...
In the following code I continue to get the error: "A JSON value of type array is expected". What am I doing wrong?
The token.txt file has the data in it that you see commented at the top of my source code. The program breaks at line 21: ExtractJSONList(JSONValue(0), Token())
Thanks for your help in advance!
In the following code I continue to get the error: "A JSON value of type array is expected". What am I doing wrong?
The token.txt file has the data in it that you see commented at the top of my source code. The program breaks at line 21: ExtractJSONList(JSONValue(0), Token())
Code: Select all
; File: token.txt
;{
; "token_type": "BearerToken",
; "issued_at": "1545950151716",
; "scope": "",
; "expires_in": 3599,
; "access_token": "VXqAKoCDUiNFlsDqGorAP77LVrEI"
;}
Structure TokenS
Token_Type.s
Issued_At.s
Scope.s
Expires_In.i
Access_Token.s
EndStructure
Global NewList Token.TokenS()
If LoadJSON(0, "z:\api\source\token.txt")
ExtractJSONList(JSONValue(0), Token()) ; breaks here!
FreeJSON(0)
Else
Debug "Error reading file: " + JSONErrorMessage()
EndIf
ForEach Token()
Debug(Token()\Access_Token)
Next Token()