I have a really simple example:
import org.json4s._
import org.json4s.native.JsonMethods._
import org.json4s.JsonDSL._
val json = ("english" -> JString("serialization")) ~ ("japanese" -> JString("シリアライゼーション"))
println(pretty(render(json)))
What I get out of that is:
{
"english":"serialization",
"japanese":"\u30b7\u30ea\u30a2\u30e9\u30a4\u30bc\u30fc\u30b7\u30e7\u30f3"
}
What I want is this (perfectly valid AFAIK) JSON:
{
"english":"serialization",
"japanese":"シリアライゼーション"
}
I can't find it now, but I think I've read somewhere that JSON only requires two special UTF-8 characters to be escaped.
Looking at the code for render, it appears that Strings always get this extra double-escaping for non-ASCII characters.
Anyone know how I can get valid JSON without double-escaping all the UTF-8 extended characters? This seems like a very similar issue to: Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?
Update: It turns out this is an open issue in json4s with a pending PR #327 which was closed in favor of PR #339 which in turn merged into the 3.4 release branch in a commit on Feb 13, 2016.