Added code to save to json format, to calculate euclidean and pearson distances