write data to json