Classic ASP
Classic ASP
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 Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set rest = Server.CreateObject("Chilkat.Rest")
bTls = 1
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( rest.LastErrorText) & "</pre>"
Response.End
End If
' 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.
set json = Server.CreateObject("Chilkat.JsonObject")
rest.GetLastJsonData json
json.EmitCompact = 0
jsonStr = json.Emit()
Response.Write "<pre>" & Server.HTMLEncode( jsonStr) & "</pre>"
' JSON parsing code for this result can be generated at Chilkat's online tool:
' https://tools.chilkat.io/jsonParse
%>
</body>
</html>