Why does the value of grater [BigThing] .asDBObject (v) in Salat have nested fields turned into Array?

Here is the import I'm using:

import com.novus.salat._ import com.novus.salat.global.ctx import net.liftweb.json._ import com.mongodb.casbah.Imports._ 

I have two case classes:

 case class BigThing (thing: Thing ) case class Thing(x:Int, y:Int) 

My grater correctly creates a DBObject with field names when there is only one lattice:

 implicit val formats = DefaultFormats val t = parse("""{"x":5, "y":6}""").extract[Thing] println("t " + t) val dboT = grater[Thing].asDBObject(t) println("dboT " + dboT) 

Fingerprints:

  t Thing(5,6) dboT { "_typeHint" : "Thing" , "x" : 5 , "y" : 6} 

But when the BigThing lattice, the Thing field names turn into an array:

  val bt = parse(""" { "thing": {"x":5, "y":6} } """).extract[BigThing] println("bt " + bt) val dboBt = grater[BigThing].asDBObject(bt) println("dboBt " + dboBt) 

Fingerprints:

 bt BigThing(Thing(5,6)) dboBt { "_typeHint" : "BigThing" , "thing" : [ 5 , 6]} 

This is mistake? Am I doing something wrong?


My build.sbt indicates the following:

 name := "hello" resolvers ++= Seq( "ScalaNLP Maven2" at "http://repo.scalanlp.org/repo", "Spray repo" at "http://repo.spray.cc/", "Typesafe repo" at "http://repo.typesafe.com/typesafe/releases/", "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots") libraryDependencies ++= Seq( "com.novus" %% "salat-core" % "1.9.1-SNAPSHOT", "cc.spray" %% "spray-json" % "1.1.1", "com.mongodb.casbah" % "casbah_2.9.1" % "2.1.5-1", "net.liftweb" %% "lift-json" % "2.5-SNAPSHOT" ) 
+4
source share

All Articles