I am using the force-directed tree from amCharts https://www.amcharts.com/demos/force-directed-tree/ to visualize data from json file using the following (in place of the chart.data part of the code):
chart.dataSource.url = "test.json";
chart.dataSource.parser = new am4core.JSONParser();
chart.dataSource.parser.options.emptyAs = 0;
However, I want to convert a csv file into a hierarchy json file first. I have attempted this solution Convert csv to JSON tree structure? but it did not work for the following csv file
condition, target, sub, dub
oxygen,tree,G1,T1
oxygen,tree,G2,T1
oxygen,tree,G2,T2
water,car,G3,T1
water,tree,GZ,T1
water,tree,GZ,T2
fire,car,GTD,T3
oxygen,bomb,GYYS,T1
It displays three separate trees instead.