Add raw data ID field to the result of trainer.predict

The test file form is like {‘id’ : xxx, ‘text’ : xxx}
I would like my output form be like {‘id’ : xxx, ‘answer’ : xxx}

I’ve used trainer.predict to get the answers of test file, but I am not sure if it is okay for me to just add the ‘id’ field to the prediction like :

for i, pred in zip(raw_test[‘id’], predictions):
write{‘id’: i, ‘answer’: pred}

which assume that the return prediction is in-order.