The structure of this project is hugely inspired by scalapb-json4s
Dependency
Include in your build.sbt
file
libraryDependencies += "io.github.scalapb-json" %% "scalapb-argonaut" % "0.2.2"
for scala-js, scala-native
libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut" % "0.2.2"
for ScalaPB 0.6.x
see https://github.com/scalapb-json/scalapb-argonaut/tree/0.1.x
Usage
There are four functions you can use directly to serialize/deserialize your messages:
JsonFormat.toJsonString(msg) // returns String
JsonFormat.toJson(msg) // returns Json
JsonFormat.fromJsonString(str) // return MessageType
JsonFormat.fromJson(json) // return MessageType