I want to format the following data from String to "set of data" to match the series in HighCharts.
I've tried parsing it with JSON.parse but, of course, this is not a JSON, so it won't work.
So I have the following string:
var str = "[
{name: 'Abril', data: [107, null, 635, 203, 2]},
{name: 'Mayo', data: [133, 156, 947, 408, 6]},
{name: 'Junio', data: [1052, null, 4250, 740, 38]}
]"
The desired result is:
var data = [
{name: 'Abril', data: [107, null, 635, 203, 2]},
{name: 'Mayo', data: [133, 156, 947, 408, 6]},
{name: 'Junio', data: [1052, null, 4250, 740, 38]}
]
Replacing the quotes with nothing won't work either.