Basic understanding of JSON: Finding via HTTP request?

Suppose I wanted to build an autoresponder via Twilio Studio. Twilio Studio can perform an HTTP request and pull in JSON and base responses off that JSON.

If I have a page that returns JSON objects, but there is other stuff on the page, how would an HTTP request parse through the other “junk” and find what it wants?

Usually languages that pull in JSON text have parsers that build objects with the data. For instance if you had something like…

   'somekey': 'somevalue',
   'somejunk': 'we_do_not_care'

This would come in as an object that has two properties somekey and somejunk. You would then just never use somejunk. Just because it comes in and is a property of the object, doesn’t mean you use it.

Now ideally you would tailor your HTTP queries to only have the service return the stuff you want, but that is not always something you can do if you don’t control the service generating the JSON. All you can do is just never use the data that you don’t need.

Edit: Perhaps I am not understanding the question fully. Are you talking about parse through the stuff gathered from the JSON or parse the page? If it is parsing the JSON, then my answer above is correct.


Why is your page returning both? Are you sure your page is returning both? Take a look at the Network graph of your page request, and see if the JSON is coming from another URL that you may be able to access directly without the ‘other stuff’.

So here is a scenario:

I want to build an autoresponder for a local bar.

When a user sends and SMS with a body of “events” Twilio will HTTP to a page on on the bar’s website where the current events can be parsed to send them back to the sender.

I’m just trying to figure out how I would hand the events back to Twilio when Twilio Studio sends the HTTP request.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.