First, you have to check if your JSON structure correctly matches the data in your TSV or CSV. For instance, suppose that this is your CSV:

foo, bar
4, 5
12, 2
3, 61

Your JSON should be like this:

   "foo": 4,
   "bar": 5
   "foo": 12,
   "bar": 2
   "foo": 3,
   "bar": 61

That is, an array of objects. Sometimes, in very big and complex JSONs, it's easy to forget a comma or a brace. I use codebeautify to check:

And, then, just change d3.tsv for d3.json:

d3.json("data.json", function(data){
    console.log(data); //just to check if it's all right
    //the rest of your code

NOTE: Contrary to d3.csv and d3.tsv, you cannot provide an accessor function to d3.json.

Related Query

More Query from same tag