MongoDB DBObject 和 org.json.JSONObject 之间的桥梁?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12792632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A bridge between MongoDB DBObject and org.json.JSONObject?
提问by Eran Medan
I'm using the native MongoDB driver and API, which uses com.mongodb.DBObjectto represent JSON objects, however for general purpose I have usage of org.json.JSONOBject.
我正在使用本机 MongoDB 驱动程序和 API,它用于com.mongodb.DBObject表示 JSON 对象,但是出于一般目的,我使用org.json.JSONOBject.
I thought of replacing it and using DBObject as a general JSON library, but it doesn't feel right.
想过把它替换掉,用DBObject作为通用的JSON库,但是感觉不太对。
But to interop with the two, the low level String/Map format/parse interface is used, which I don't like either.
但是为了与两者互操作,使用了低级 String/Map 格式/解析接口,我也不喜欢它。
Is there a known library out there that implements both interfaces for easier interoperability?
是否有一个已知的库可以实现两个接口以实现更轻松的互操作性?

