I'm trying to convert a parsed JSON document in a lift-json's JValue into a Casbah MongoDBObject - is there a way to do this?
Asked
Active
Viewed 1,299 times
2 Answers
3
You can convert the lift-json into a Map[String, Any] and then use the implicit asDBObject method on Map:
val record = record.values.asInstanceOf[Map[String, Any]]
record.asDBObject

tommy chheng
- 9,108
- 9
- 55
- 72
-
This works, but lift-json uses `BigInt` for it's `JInt` implementation which is not compatible with mongodb. Any way to work around this? – Ben Schmidt Dec 11 '13 at 02:17
2
Then there is also the net.liftweb.mongodb.JObjectParser
with its parse
method. The Casbah implicit will convert DBObject
into MongoDBObject
.

Rajish
- 6,755
- 4
- 34
- 51