[Chartjs]-Using JSON file data in Chart.js

2👍

The JSON in that txt file is not a valid JSON object. You need to use regular quotes like so:

[{"date": "1/02/16", "price":15.25},
{"date":"29/01/16", "price":15.35},
{"date":"28/01/16", "price":15.1}];

Also you can use jQuery’s $.getJSON function here:

var myJSON = $.getJSON( "example.json", function() {
  console.log( "success" );
})

see here: http://api.jquery.com/jquery.getjson/

Leave a comment