0

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?

sergeda
  • 2,061
  • 3
  • 20
  • 43

1 Answers1

2

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.

tkachuko
  • 1,956
  • 1
  • 13
  • 20