Converting JSON Structure to BasicDBObject

后端 未结 2 1660
说谎
说谎 2021-02-07 10:18

I want to convert the following json structure to BasicDBOject in java and insert into mongo db.

My JSON structure is

{
    \"         


        
2条回答
  •  礼貌的吻别
    2021-02-07 11:14

    com.mongodb.util.JSON has a parse method.

    BasicDBObject implements DBObject

    Object o = com.mongodb.util.JSON.parse("Your JSON structure or JSONObj.toString()");
    DBObject dbObj = (DBObject) o;
    

提交回复
热议问题