Skip to content

0.8.3

Compare
Choose a tag to compare
@eed3si9n eed3si9n released this 13 Jul 22:35
v0.8.3
1b10d78

sjson-new 0.8.3 is cross published against Scala 2.10, 2.11, 2.12, and 2.13.

#105 by @xuwei-k and #106 by @eed3si9n

Tuple-like syntax on LList

scala> import sjsonnew._, BasicJsonProtocol._, support.scalajson.unsafe._
import sjsonnew._
import BasicJsonProtocol._
import support.scalajson.unsafe._

scala> val xs = "age" -> 39 :*: "name" -> "foo" :*: LNil
xs: Int :*: (String :*: sjsonnew.LNil) = (age, 39) :*: (name, foo) :*: LNil

scala> val tryJson = Converter.toJson[Int :*: String :*: LNil](xs)
tryJson: scala.util.Try[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = Success(JObject([Lsjsonnew.shaded.scalajson.ast.unsafe.JField;@6ed85780))

scala> PrettyPrinter(tryJson.get)
res0: String =
{
  "$fields": ["age", "name"],
  "age": 39,
  "name": "foo"
}

scala> xs._1
res1: Int = 39

scala> xs._2
res2: String = foo

This was contributed @dwijnand as #88