Writes to JSON