0
final case class Stuff(metadata: Option[String]) {
val metadataJson: JObject = parse(metadata.getOrElse("{}")).asInstanceOf[JObject]
}

This throws a type mismatch error

found: Object

required: JsonInput

But it shouldnt happen since metadata.getOrElse.. should be type String which is casted to JsonInput

fuzzycuffs
  • 139
  • 1
  • 15

1 Answers1

0

Sooo it turns out that getorelse messes with implicit type conversion because it can technically return any type >: String

easy fix is just to specify type

parse(metadata.getOrElse[String]("{}")).asInstanceOf[JObject]
fuzzycuffs
  • 139
  • 1
  • 15