Home Forums Chart Support Ignore part of JSON

Ignore part of JSON

Viewing 2 posts - 1 through 2 (of 2 total)
  • #22640

    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?

    #22647

    @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.

    
    $.getJSON("test.js", function(jsonData) {
        var data = jsonData.Data;
     });
    


    Vishwas R
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.