Command for export :
mongoexport --db <dbname> --collection <collectionname> --out collection.json
Once exported, if there are BSON data is there, we can follow the below methods
Official MongoDB Java Driver comes with **utility methods for parsing JSON to BSON and serializing BSON to JSON**.
import com.mongodb.DBObject;
import com.mongodb.util.JSON;
DBObject dbObj = ... ;
String json = JSON.serialize( dbObj );
DBObject bson = ( DBObject ) JSON.parse( json );
The driver can be found here: https:
In this way, if we take, we can convert easily.