Moved the random ID to json_generator to prevent duplications.