Skip to content Skip to sidebar Skip to footer

D3.js Get Json From Url

The situation is that i am trying to get d3 to read a JSON file which is stored in Windows Azure Blob storage. If i paste the url into a browser then the file is downloaded to my m

Solution 1:

Should be:

var url = "http://storageName.blob.core.windows.net/containerName/file.json";
d3.json(url, function (json) {
    //code here
});

Solution 2:

Relevant for 2019:

d3.json("http://127.0.0.1:8080/mydata.json").then( data => {
    console.log(data);
})

Solution 3:

you'll have to set the Content-Type http header to "application/json" on your blob.

It can be done programmatically or using the rest API, or using a free utility like cloudberry explorer for azure blob storage.

Solution 4:

For REST api use d3.request:

d3.fetch("api_url/path")
.header("Content-Type", "application/json")
.post(function(data) {
   console.log(data);
})

Post a Comment for "D3.js Get Json From Url"