I have a string like this:
abc=foo&def=%5Basf%5D&xyz=5
How can I convert it into a JavaScript object like this?
{
For Node JS, you can use the Node JS API querystring:
querystring
const querystring = require('querystring'); querystring.parse('abc=foo&def=%5Basf%5D&xyz=5&foo=b%3Dar'); // returns the object
Documentation: https://nodejs.org/api/querystring.html