generating samples and writing to json works