GitXplorerGitXplorer
x

play-json-extra

public
19 stars
1 forks
3 issues

Commits

List of commits on branch master.
Unverified
67e444b4b5484a2998f90facdbbad7f101948214

Update scala-library to 2.13.16

sscala-steward-bot committed 8 days ago
Unverified
85eac4e6ae5f40d61c1a9fb2b4e2ec58b7e28643

Update sbt-scalajs, scalajs-compiler, ... to 1.18.1

sscala-steward-bot committed 10 days ago
Verified
bb78904e1d4136e9e6abeda047eb198c1c504bba

eetup-sbt

xxuwei-k committed 10 days ago
Unverified
f146ca3be512f57b0b38bb6811c00ecbb8e7b6a0

Update sbt-scalajs, scalajs-compiler, ... to 1.18.0

sscala-steward-bot committed 12 days ago
Unverified
94ffd5bee41ddb14c4849900881fefdfdfee2610

Update sbt, scripted-plugin to 1.10.7

sscala-steward-bot committed a month ago
Unverified
5ff5953b548fa88ea19fb5d7d1e809185055f419

Update sbt-pgp to 2.3.1

sscala-steward-bot committed a month ago

README

The README file for this repository.

play-json-extra

Scala.js scaladoc

motivation and example

I think following way is so verbose.

import play.api.libs.json._
import play.api.libs.functional.syntax._

final case class User(id: Long, name: String)

object User {
  implicit val format: OFormat[User] = (
    (__ \ "id").format[Long] and // I want to omit `Long` and `String`
    (__ \ "name").format[String]
  )(apply _, Function.unlift(unapply))
}

Play provides Json macros. Yes it is useful, but I want to specify Json keys explicitly sometime like argonaut casecodecN

import play.api.libs.json._
import play.jsonext._

final case class User(id: Long, name: String)

object User {
  implicit val format: OFormat[User] =
    CaseClassFormats(apply _, unapply _)("id", "name")
}

latest stable version for play-json 2.8

libraryDependencies += "com.github.xuwei-k" %% "play-json-extra" % "0.9.0"

for scala-js

libraryDependencies += "com.github.xuwei-k" %%% "play-json-extra" % "0.9.0"