是否有可能與阿卡(也許有些噴霧 「utils的」?)來構建緊湊JSON給料從case class
這樣開始:Akka:如何創建一個沒有空值的緊湊json?
case class Stuff (val1: String, val2: String, val3: String)
內置了這種方式:
Stuff("one value", "", "another value")
並得到一個緊湊的形式,將跳過「空值」,將返回的JSON:
{"val1" : "one value", "val3" : "another value"}
?
我寧願堅持使用'spray.json'解決方案,因爲我已經使用它了。 – Randomize
我得到:錯誤:(10,50)無法找到JsonWriter或JsonFormat類型的東西 val sth =某些東西(「john」,無,「johnson」).Json – Randomize
解決方法是:將MyJsonProtocol放入另一個文件並在'println'之上添加'import MyJsonProtocol._' – Randomize