Receiving a Webhook JSON POST in Classic ASP


I need to setup a page in Classic ASP to serve as a webhook endpoint listener in Classic ASP
The form product we are using (Paperform) posts the data to our endpoint as a JSON post payload.

Submission payload

Webhooks POST a JSON payload on submission to the webhook URL. The JSON payload looks like the following:
"data": [
 "title": "question 1", //Title of question as defined
 "description": "This is the second question",
 "type": "address", //Question type
 "key": "xxxxx", //Question pre-fill key (unique to form).
 "value": "343 Tester Road, Snohomish, Washington, 98290, United States" //Submitted value for question
 "custom_key": "address_1" //Custom pre-fill key (if set).
 "title": "question 2",
 "description": "This is the second question",
 "type": "text",
 "key": "tgp8",
 "value": "Test 123",
 "custom_key": ""
//... each question has its own object.
"submission_id": "XXXXXXXXXXXXXXXXXXX", //Unique ID for submission.
"created_at": "2017-06-09 09:51:23", //Submission date
"ip_address": "", //IP Address of submission
"charge": null //if a payment is made, payment information is given here.
A typical POST that sends JSON is a POST where the request body contains the JSON document (as opposed to a multipart/form-data POST where the body contains multiple parts, or a application/x-www-form-urlencoded POST where the body is composed of keys and values encoded in key-value tuples separated by ‘&’, with a ‘=’ between the key and the value.
Therefore, you want to get the raw body of the POST, and you do it like this:
If Request.TotalBytes > 0 Then
    Dim lngBytesCount
        lngBytesCount = Request.TotalBytes
    jsonStr = BytesToStr(Request.BinaryRead(lngBytesCount))
End If
However, JSON uses the utf-8 byte representation.  I would guess that BytesToStr is expecting the bytes to be in ANSI representation and would mangle non-us-ascii chars.  It would be safer to use Chilkat to be explicit about utf-8 encoding:
set bd = Server.CreateObject("Chilkat_9_5_0.BinData")
success = bd.AppendBinary(Request.BinaryRead(lngBytesCount))
set sbJson = Server.CreateObject("Chilkat_9_5_0.StringBuilder")
success = sbJson.AppendBd(bd,"utf-8",0,0)

' now you have the JSON in a Chilkat StringBuilder object.
' you can access it as a string in ASP
strJson = sbJson.GetAsString()

' or you can load it directly into a JsonObject
set json = Server.CreateObject("Chilkat_9_5_0.JsonObject")
success = json.LoadSb(sbJson)