We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code:
import org.json4s.DefaultFormats import org.json4s.jackson.Serialization case class Id(id: String) extends AnyVal case class Data1(id: Id, name: String) case class Data2(id: Option[Id], name: String) object Json4sTest { implicit val formats = DefaultFormats def main(args: Array[String]): Unit = { val data1 = Data1(Id("17"), "foo") val data2 = Data2(Some(Id("17")), "foo") println(s"json 1: ${Serialization.write(data1)}") println(s"json 2: ${Serialization.write(data2)}") } }
actual output:
json 1: {"id":"17","name":"foo"} json 2: {"id":{"id":"17"},"name":"foo"}
expected output:
json 1: {"id":"17","name":"foo"} json 2: {"id":"17","name":"foo"}
or maybe:
json 1: {"id":{"id":"17"},"name":"foo"} json 2: {"id":{"id":"17"},"name":"foo"}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
json4s version 3.5.0
scala version 2.11.8
jdk version 1.8.0_45
Code:
actual output:
expected output:
or maybe:
The text was updated successfully, but these errors were encountered: