I am trying to read json file using D3 library but when i try to read json i get alert Null Values (here i am using alert).
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Simple venn.js example</title>
</head>
<body>
<div id="weighted_example"></div>
</body>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
d3.json( "file.json", function( json ) {
alert( "JSON Data: " + json );
});
</script>
</html>
Following is file.json (which is already validated online)
[{
"sets": [0],
"size": 1958
},
{
"sets": [1],
"size": 1856
},
{
"sets": [2],
"size": 1297
},
{
"sets": [0, 1],
"size": 220
},
{
"sets": [2, 0],
"size": 123
},
{
"sets": [2, 1],
"size": 139
}
]
How can i fix such issue?