小编use*_*908的帖子

java如何将字符串转换为net.sf.json.JSONObject

我收到推文并使用 org.json.simple api 将字符串转换为对象。

JSONParser jsonParser = new JSONParser();
Object json = jsonParser.parse(in);
Run Code Online (Sandbox Code Playgroud)

我想使用 couchdb4j api 将 obj 插入到 couchdb

 Session myDbSession = new Session("localhost",5984)
    Database myCouchDb = myDbSession.getDatabase("db-name");
    Document newdoc = new Document();
    Document newdoc = new Document(JSONObject json);
    myCouchDb.saveDocument(newdoc);
Run Code Online (Sandbox Code Playgroud)

错误是:

   org.json.simple.JSONObject cannot be cast to net.sf.json.JSONObject
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题或者任何人都可以给出将json格式字符串或对象插入到couchdb中的解决方案

java json couchdb

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

couchdb ×1

java ×1

json ×1