Closed beatinger closed 3 years ago
Hi @beatinger, There are some examples on how to create and add properties to an object in the README page.
I will give you some examples based on your data, as it also contains a child object:
<%
Set message = New JSONObject
message.Add "account_sid", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
message.Add "api_version", "2010-04-01"
' ...
' Create sub resource object
Set subResource = New JSONObject
subResource.Add "media", "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json"
message.Add "subresource_uris", subResource
' ...
Dim jsonString
jsonString = message.Serialize() ' this will contain the JSON string to post
%>
Hello Ricardo,
Wow...thank you so much for your very quick reply! This is great, and is exactly what I am looking for. I will try this today, and let you know the results. I went through the code first, to see if this might be possible, and your message confirms that it is indeed. Thank you again!
I am already using this excellent class for parsing JSON strings returned from various REST APIs, but I have yet to figure out how to use it for creating a properly formatted JSON structure, from information within an ASP program. For example, the following is data that I need to send to the twilio.com SMS messaging API via a standard XMLHTTP request. How would I get this properly formatted in a proper JSON structure prior to making the send call?
{ "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "api_version": "2010-04-01", "body": "Hi there!", "date_created": "Thu, 30 Jul 2015 20:12:31 +0000", "date_sent": "Thu, 30 Jul 2015 20:12:33 +0000", "date_updated": "Thu, 30 Jul 2015 20:12:33 +0000", "direction": "outbound-api", "error_code": null, "error_message": null, "from": "+14155552345", "messaging_service_sid": null, "num_media": "0", "num_segments": "1", "price": null, "price_unit": null, "sid": "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "status": "sent", "subresource_uris": { "media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json" }, "to": "+14155552345", "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" }"