I'm trying to use µPickle in Scala.js to produce Json for Ajax request. Here is my code:
import upickle._
import upickle.default._
case class FmData(name: String, comment: String)
val data = write(FmData("name", "comment"))
And I get error:
Couldn't derive type FmData
How come?
The same issue happened to me before. It was happening when I was defining this case class in package
object, other object
or inside of method. However when I extracted it to a separate file, it was all fine and working.
Hope it helps.