Skip to content

Commit

Permalink
fix Json.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Apr 2, 2024
1 parent fddaa47 commit 1bb5d9c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions playJson/src/main/scala/Json.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package scalalib
package json

import play.api.libs.json.{ Json as PlayJson, * }
import java.time.Instant

import scala.util.NotGiven
import scalalib.newtypes.SameRuntime
import scalalib.model.*
import scalalib.time.toMillis

object Json:

Expand Down Expand Up @@ -71,11 +75,6 @@ object Json:
Writes[O](o => JsString(to(o)))
)

given userStrReads: Reads[UserStr] = Reads
.of[String]
.flatMapResult: str =>
JsResult.fromTry(UserStr.read(str).toTry(s"Invalid username: $str"))

given Writes[Instant] = writeAs(_.toMillis)

// given Writes[chess.Color] = writeAs(_.name)
Expand Down

0 comments on commit 1bb5d9c

Please sign in to comment.