Mongo Upgrade issue.

I’m using MongoDB 4.0 and taking backups using mongodump version 4.0. I need to migrate the data from one machine to another, and at the same time, I’m planning to upgrade to MongoDB 4.2. However, when I use mongorestore, I encounter the following error:

error decoding key options.1:1: invalid JSON input expected

Kindly help me resolve this issue.