Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scalapb-json/scalapb-argonaut

Json/Protobuf convertors for ScalaPB use argonaut
https://github.com/scalapb-json/scalapb-argonaut

json protobuf scala scala-js scala-native scalapb

Last synced: 2 months ago
JSON representation

Json/Protobuf convertors for ScalaPB use argonaut

Awesome Lists containing this project

README

        

# scalapb-argonaut
[![scaladoc](https://javadoc.io/badge2/io.github.scalapb-json/scalapb-argonaut_3/javadoc.svg)](https://javadoc.io/doc/io.github.scalapb-json/scalapb-argonaut_3/latest/api/scalapb_argonaut.html)

The structure of this project is hugely inspired by [scalapb-json4s](https://github.com/scalapb/scalapb-json4s)

## Dependency

Include in your `build.sbt` file

### core

```scala
libraryDependencies += "io.github.scalapb-json" %% "scalapb-argonaut" % "0.11.0"
```

for scala-js

```scala
libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut" % "0.11.0"
```

### macros

```scala
libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut-macros" % "0.11.0"
```

## Usage

There are four functions you can use directly to serialize/deserialize your messages:

```scala
JsonFormat.toJsonString(msg) // returns String
JsonFormat.toJson(msg) // returns Json

JsonFormat.fromJsonString(str) // return MessageType
JsonFormat.fromJson(json) // return MessageType
```

### Credits

- https://github.com/whisklabs/scalapb-playjson
- https://github.com/scalapb/scalapb-json4s