MongoDB comes with “com.mongodb.util.JSON” class to convert JSON data directly to a DBObject. For example, data represent in JSON format : { 'name' : 'mkyong', 'age' : 30 } To convert it to DBObject, you can code like this : DBObject dbObject = (DBObject) JSON.parse("{'name':'mkyong', 'age':30}"); Example See a full example to convert above JSON data to a DBObject, and save it into MongoDB. packag
![Java MongoDB : Convert JSON data to DBObject - Mkyong.com](https://cdn-ak-scissors.b.st-hatena.com/image/square/e6b4dfd4f9f121afe7b1d1c5ddd5f364925a519e/height=288;version=1;width=512/https%3A%2F%2Fmkyong.com%2Fwp-content%2Fuploads%2F2023%2F08%2Fmkyong-opengrap-logo.png)