Write to and read from JSON file.