How to convert BSON to JSON with human-readable date format
bsondump converts BSON files into human-readable formats, including JSON. For example, bsondump is useful for reading the output files generated by mongodump.
Source: https://docs.mongodb.com/manual/reference/program/bsondump
Examples
bsondump --outFile collection.json collection.bson
The --pretty
option outputs documents in a pretty-printed format JSON, eg:
bsondump --pretty --outFile collection.json collection.bson
To create a JSON file directly from the database, use mongoexport
mongoexport --db myDatabase --collection myCollection --jsonArray --out myJsonFile.json