play-json-cats


License

License

Categories

Categories

JSON Data
GroupId

GroupId

com.iravid
ArtifactId

ArtifactId

play-json-cats_2.12
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

play-json-cats
play-json-cats
Project URL

Project URL

https://github.com/iravid/play-json-cats
Project Organization

Project Organization

com.iravid
Source Code Management

Source Code Management

https://github.com/iravid/play-json-cats

Download play-json-cats_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.iravid/play-json-cats_2.12/ -->
<dependency>
    <groupId>com.iravid</groupId>
    <artifactId>play-json-cats_2.12</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.iravid/play-json-cats_2.12/
implementation 'com.iravid:play-json-cats_2.12:1.1.0'
// https://jarcasting.com/artifacts/com.iravid/play-json-cats_2.12/
implementation ("com.iravid:play-json-cats_2.12:1.1.0")
'com.iravid:play-json-cats_2.12:jar:1.1.0'
<dependency org="com.iravid" name="play-json-cats_2.12" rev="1.1.0">
  <artifact name="play-json-cats_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.iravid', module='play-json-cats_2.12', version='1.1.0')
)
libraryDependencies += "com.iravid" % "play-json-cats_2.12" % "1.1.0"
[com.iravid/play-json-cats_2.12 "1.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.4
org.typelevel : cats-core_2.12 jar 1.1.0
com.typesafe.play : play-json_2.12 jar 2.6.8

test (2)

Group / Artifact Type Version
org.typelevel : cats-laws_2.12 jar 1.0.1
org.scalatest : scalatest_2.12 jar 3.0.4

Project Modules

There are no modules declared in this project.

Build Status Maven Central

play-json-cats

cats typeclass instances for the play-json library.

Adding as a dependency to your project

libraryDependencies += "com.iravid" %% "play-json-cats" % 1.1.0

play-json-cats is cross-published for Scala 2.11 and 2.12.

Usage

import cats.implicits._
import com.iravid.playjsoncats.implicits._
import play.api.libs.json._

case class Person(name: String, i: Int)

val rn: Reads[String] = Reads(j => (j \ "name").validate[String])
val ri: Reads[Int] = Reads(j => (j \ "i").validate[Int])
val rp: Reads[Person] = (rn, rp).mapN(Person)

val res: JsResult[Person] = rp.reads(Json.parse("""
  { "name": "iravid", "i": 42 }
"""))

Provided instances

play-json type provided instances
Reads[A] Functor, Applicative, Monad
Writes[A] Contravariant
Format[A] Invariant
JsResult[A] Functor, Applicative, ApplicativeError
Monad, MonadError, Traverse,
Monoid (for A: Monoid)

Versions

Version
1.1.0
1.0.0