Skip to content

Instantly share code, notes, and snippets.

@sleepynate
Created July 30, 2013 23:36
Show Gist options
  • Save sleepynate/6118008 to your computer and use it in GitHub Desktop.
Save sleepynate/6118008 to your computer and use it in GitHub Desktop.
[error] app/models/Job.scala:22: ambiguous implicit values:
[error] both object IntReads in trait DefaultReads of type play.api.libs.json.Reads.IntReads.type
[error] and object LongReads in trait DefaultReads of type play.api.libs.json.Reads.LongReads.type
[error] match expected type play.api.libs.json.Reads[T]
[error] case Some(bs) => bs.map(Json.fromJson(_))
@sleepynate
Copy link
Author

when using something like:

object Build {
  implicit val buildWrites = Json.writes[Build]
  implicit val buildReads = Json.reads[Build]
}

@jamesward
Copy link

What does Build look like?

@nraychaudhuri
Copy link

It's an error on intreads. What is the type of bs?

@sleepynate
Copy link
Author

Ahh, it's just a case class

case class Build(result:String, timestamp:Long, url:String, culprits:Seq[String] = List())

@sleepynate
Copy link
Author

I realize I didn't fully answer your question earlier @nraychaudhuri. bs is a Seq[Build]. In this case it is always a List[Build]

@sleepynate
Copy link
Author

Is the problem here? https://github.com/playframework/playframework/blob/master/framework/src/play-json/src/main/scala/play/api/libs/json/Reads.scala#L144

Does it need a case statement that checks for a NumberFormatException like Reads[BigDecimal] does?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment