Visual FoxPro
Visual FoxPro
Get JSON Details from the Last REST Operation
See more REST Examples
Demonstrates Rest.GetLastJsonData, which copies operation-specific diagnostic or result information from the most recently completed method into a JsonObject. Many methods produce no JSON, in which case the object is empty.
Tip: Code to parse the returned JSON can be generated with Chilkat's online tool at https://tools.chilkat.io/jsonParse.
Background. Some Chilkat operations expose additional structured information as JSON. GetLastJsonData provides access to that information after an operation completes.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loRest
LOCAL lnBTls
LOCAL lnBAutoReconnect
LOCAL loJson
LOCAL lcJsonStr
lnSuccess = 0
loRest = CreateObject('Chilkat.Rest')
lnBTls = 1
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("example.com",443,lnBTls,lnBAutoReconnect)
IF (lnSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
* Copy operation-specific diagnostic or result information from the most recent method (here the
* Connect call) into a JsonObject. Many methods produce no JSON, in which case the object is empty.
loJson = CreateObject('Chilkat.JsonObject')
loRest.GetLastJsonData(loJson)
loJson.EmitCompact = 0
lcJsonStr = loJson.Emit()
? lcJsonStr
* JSON parsing code for this result can be generated at Chilkat's online tool:
* https://tools.chilkat.io/jsonParse
RELEASE loRest
RELEASE loJson