I have an expected response, which could be in any format, but for example:
myfoo={FOO}&mybar={BAR}&mybaz={BAZ}
Then I have the response string:
myfoo=hello&mybar=test&mybaz=yup
So my question is, in JavaScript, how can I use these two strings to create an object containing the values, like so:
{
FOO : 'hello',
BAR : 'test',
BAZ : 'yup'
}
In another example the expected string could be a sentence:
Hello, my name is {NAME} and I am {AGE} years old.
Then the actual response:
Hello, my name is Fred and I am 30 years old.
Which should build:
{
NAME : 'Fred',
AGE : '30'
}