Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
99
rated 0 times [  102] [ 3]  / answers: 1 / hits: 30378  / 11 Years ago, fri, march 29, 2013, 12:00:00

I am trying to implement a line chart using highcharts, in which I want to color specific points.



So I am using following statement.



JSON.parse([{x: 1,y: 0},{x:2,y:5,marker:{fillColor:'red'}},{x:3,y:8}]);


to color the point (2,5) as red.



But, it is showing error as SyntaxError: JSON.parse: expected property name or '}'


More From » json

 Answers
10

Valid JSON strings require the property names to be quoted.



This can be corrected by quoting the property names like below:



JSON.parse('[{x: 1, y: 0}, {x:2, y:5, marker: {fillColor:red}}, {x:3, y:8}]');

[#79249] Thursday, March 28, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aileent

Total Points: 556
Total Questions: 107
Total Answers: 101

Location: Croatia
Member since Fri, Sep 11, 2020
4 Years ago
;