From a GET request to a service I receive a JSON object like this:
{
"id": "SWKJHFDJHSDFLSVNDHLSDKJHNLSDLSDNVLKVSNLK",
"payload": "{ att1: value1, att2: value2}"
}
When it should be like this:
{
"id": "SWKJHFDJHSDFLSVNDHLSDKJHNLSDLSDNVLKVSNLK",
"payload": { "att1": "value1", "att2": "value2"}
}
The problem is that the payload has a bad format for a JSON object, and I can't transform it into a real object with JSON.parse().
How can I transform "{ att1: value1, att2: value2}" into a real JavaScript object?
"{ a: a1, b: b1 }"