how to convert a jsonobject to a dbobject

Java
 DBObject object = (DBObject) JSON.parse(obj.toString());
 collection.insert(object)
Source

Also in Java: