scalapb-json / scalapb-argonaut   0.10.0

MIT License GitHub

Json/Protobuf convertors for ScalaPB use argonaut

Scala versions: 3.x 2.13 2.12
Scala.js versions: 1.x
Scala Native versions: 0.4

scalapb-argonaut

scaladoc

The structure of this project is hugely inspired by scalapb-json4s

Dependency

Include in your build.sbt file

core

libraryDependencies += "io.github.scalapb-json" %% "scalapb-argonaut" % "0.10.0"

for scala-js

libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut" % "0.10.0"

macros

libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut-macros" % "0.10.0"

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

Credits