Last active
October 7, 2016 02:21
-
-
Save mocyuto/30c88a43d9d02f0953d0abad84bbda83 to your computer and use it in GitHub Desktop.
Value Class behaves strange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json4s._ | |
import org.json4s.jackson.JsonMethods._ | |
import org.json4s.jackson.Serialization._ | |
Object Temp{ | |
case class Attributes(value: String) extends AnyVal | |
case class Temp(seq: Seq[Attributes]) | |
def main(args: Array[String]): Unit = { | |
val a = """ {"seq":["test"]} """ | |
val b = Seq("test") | |
println(parse(a).extract[Temp]) | |
println(Temp(b.map(c => Attributes(c)))) | |
} | |
// this behaves such as below | |
// Temp(List(test)) | |
// Temp(List(Attributes(test))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment