convert data from server to json for line chart