Simon
Simon

Reputation: 736

Create array from string - with complex types for highchart

I have this text string:

 [[Date.UTC(2012,8, 1), 2],[Date.UTC(2012,9, 31), 3],[Date.UTC(2013,0, 31), 3]]

and when I paste it like that, it works fine, but getting it from a string does not work, Can't seem to use JSON.parse() because of the Date.UTC thing.

http://jsfiddle.net/NmFjj/

two samples shown. I need to be able to convert that string to an array so the highcharts works correctly.

Upvotes: 0

Views: 90

Answers (1)

Trylks
Trylks

Reputation: 1498

Try eval instead of JSON.parse.

Upvotes: 1

Related Questions