How to parse POST Request

This question has been answered before but none of the answers worked for me.

Here is what I have currently.

var queryString = util.inspect(event.body);
console.log(“queryString=”+queryString)

If I do this I see the results from Twilio that look like this in the body…

'Called=%2B15622225123&ToState=CA&CallerCountry=US&Direction=inbound&CallerState=CA&ToZip=90670&CallSid=CA47e5131dd5e7375190aaf5fab773a9b0&To=%2B15622221253&CallerZip=92606&CallerName=

How do I convert all these parameters into variables I can work with and do logic from thereafter?

@x11joe It’s just a regular query string format. You can use https://nodejs.org/docs/latest-v6.x/api/querystring.html or any NPM package that can decode a query string.

Thanks for your reply I found a good library QS that fixes this really nicely. I’m still new to JS, coming from PHP.