added function to convert data to json format for d3