D3.js json() Function Last Updated : 31 Aug, 2020 Comments Improve Suggest changes Like Article Like Report The d3.json() function is used to fetch the JSON file. If this function got an init parameter, then this is called along with the fetch operation. Syntax: d3.json(input[, init]); Parameters: This function accepts two parameters as mentioned above and described below. input: This parameter takes the address of the input file. init: This parameter takes a function that does some operation with the data of the file. Note: Please create a JSON file named "sample.json" before writing the given example. Example: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent= "width=device-width, initial-scale=1.0" /> <script src= "https://d3js.org/d3.v4.min.js"> </script> </head> <body> <script> // Data of sample.json file // { // "place": "GeeksforGeeks", // "visitiors": "100M", // "target": "Client", // "source": "Server" // } d3.json("sample.json", function (d) { console.log(d); }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js json() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js mouse() Function The d3.mouse() function in D3.js is used to return the x-coordinate and y-coordinate of the current event when clicked. Syntax:d3.mouse(container);Parameters: This function accepts a single parameter as mentioned above and described below:container: It is the name of the container or the HTML tag to 2 min read D3.js zip() Function The zip() function in D3.js is used to form a matrix from an array given as a parameter. It helps to visualize data. D3.js stands for Data-Driven Documents. Syntax: d3.zip(arraysâ¦) Parameters: This function accepts a single parameter as mentioned above and described below: arrays: This parameter h 1 min read D3.js | d3.sum() function The d3.sum() function in D3.js is used to return the sum of the given array's elements. If the array is empty then it returns 0. Syntax: d3.sum(Array) Parameters: This function accepts a parameters Array which is an array of elements whose sum are to be calculated. Return Value: It returns the sum o 2 min read D3.js transpose() Function The transpose() function in D3.js is used to return the transpose of a 2D array. This function helps to visualize the data and making graphs and charts. Syntax: d3.transpose(Matrix); Parameters: This function accept a single parameter as mentioned above and described below: Matrix: This parameter ho 1 min read D3.js | d3.keys() Function The d3.keys() function in D3.js is used to return an array containing the property names or keys of the specified object or an associative array. Syntax: d3.keys(object) Parameters: This function accepts single parameter object containing key and value in pairs. Return Value: It returns the keys of 1 min read Like