You must be logged in to post your query.
Home › Forums › Chart Support › Ignore part of JSON
Tagged: api, getJSON, JSON
The API I am hitting returns something like {“Success”:true,”Error”:null,”Data”:[{
I only want the “Data”
Does CanvasJS have a syntax for picking at the API JSON?
@wonky,
CanvasJS just renders the chart with the data that you have passed in chart-option. You can use AJAX getJSON to get the JSON data and with the help of key, you can get its corresponding value. Please refer this tutorial for the same.
Example: If you are storing json {"Success":true,"Error":null,"Data":[{}]} as test.json, you can access Data using jsonData.Data where jsonData is the response that you get from AJAX request.
{"Success":true,"Error":null,"Data":[{}]}
$.getJSON("test.js", function(jsonData) { var data = jsonData.Data; });
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register