Here I am getting the data using the java.stringify. But to use the data which I get in the graph framework, that should not be withinquoted. I need to parse all the data which has quote in it. (eg [{data:[{x:87.6,y:85}..) What should I do here? Please help me!!
Here`s the data which I need to parse..
[{"data":[{"x":87.6,"y":85},{"x":116.08,"y":61},{"x":113.11,"y":49},{"x":181.37,"y":65},{"x":138.14,"y":74},{"x":66.03,"y":89}]}]
Use regular expression to remove quotes.
For example if it is a json string you can do this:
var json = '{ "name": "John Smith" }'; //Let's say you got this
json = json.replace(/\"([^(\")"]+)\":/g,"$1:"); //This will remove all the quotes
json; //'{ name:"John Smith" }'
In case of your input:
var a ='[{"data":[{"x":87.6,"y":85},{"x":116.08,"y":61},{"x":113.11,"y":49},{"x":181.37,"y":65},{"x":138.14,"y":74},{"x":66.03,"y":89}]}]';
a = a.replace(/\"([^(\")"]+)\":/g,"$1:");
a; //"[{data:[{x:87.6,y:85},{x:116.08,y:61},{x:113.11,y:49},{x:181.37,y:65},{x:138.14,y:74},{x:66.03,y:89}]}]"