0

I want to load some json data for a d3 visualization. Calling the json file from a URL works fine, but when i download the same file to the local folder, it throws an error.

This works fine:

var q = require("d3-queue");

q.queue()
 .defer(d3.json, "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json")
 .await(ready);

This does NOT work:

q.queue()
 .defer(d3.json, "countries-110m.json")
 .await(ready);

Throws the console error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data.

Question: How can i load json data from the local folder?

Thanks for your help!

Lucien Chardon
  • 421
  • 1
  • 8
  • 14

0 Answers0