After receiving a JSON Response from a remote server, everything looks good. I discovered an helpful script for parsing the JSON data and extracting the necessary values.
When attempting to pass the variable into JSON.parse(), I encountered an error which has been detailed in my code comments.
If anyone can help me identify where I might have gone wrong, I would greatly appreciate it. Despite trying multiple variations, I haven't had any luck so far. Thank you for taking the time to read this.
<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<!--#include file="json2.asp"-->
<%
url = "https://www.beds24.com/api/json/getBookings"
propKey = Request.QueryString("propkey")
jsonrequest = "{""authentication"": { ""apiKey"": ""XXXXXX"", ""propKey"": """&propKey&""" }, ""includeInvoice"": false, ""includeInfoItems"": false}"
'SEND JSON TO SERVER
Dim oXMLHttp
Set oXMLHttp=Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
oXMLHttp.open "POST", url,false
oXMLHttp.setRequestHeader "Content-Type", "application/json"
oXMLHttp.send jsonrequest
'GET JSON RESPONSE BACK FROM SERVER
jsonstring = oXMLHttp.responseText
'Here's the raw response from the Server
response.write(jsonstring&"<br><br><br>")
...
An error is being displayed in the browser:
Microsoft JScript compilation error '800a03ee'
Expected ')'
/API/beds24/GetBookings/json2.asp, line 765
The content of json2.asp is included below:
<script language="Javascript" runat="server">
// JavaScript code goes here...
</script>