In Play Json you can use this macro Jsonx.formatInline for example, which inlines the json object to its json property. Is there any approach to achieve this using jsoniter library?
For instance, in this code:
case class Foo(values : String)
case class WrapperOfFoo(val : rapperOfFoo)
val codec : JsonValueCodec[[WrapperOfFoo]] = JsonCodecMaker.make
val messageFoo = new Foo("test")
val message = new WrapperOfFoo(messageFoo)
val json = writeToArray(message)(codec).map(_.toChar).mkString
println(json)
The result is:
{
"val": {
"values": "test"
}
}
Desired output:
{
"val" : "test"
}
Since it's just a wrapper that has only one property, I want it to be inlined, is there a way to achieve this in JsonIter?