2

I have these 2 case classes: Topic and Report (definitions below):
case class Topic(name:String, queryWords:Set[String])

case class Report(dateRange: org.joda.time.Interval, queryWord: String, topics: Map[Topic,Boolean], allOtherTopics: Map[Topic,Boolean])

I have a list of reports which I want to serialize: reports: List[Report] but it gives me a scala.MatchError

..
val writer = new BufferedWriter(new FileWriter(file))
Serialization.write(reports, writer)      <--error right here
..

beginning or stack trace:

scala.MatchError: (Topic(steam,Set(steam)),true) (of class scala.Tuple2)
        at net.liftweb.json.Extraction$$anonfun$decompose$1.apply(Extraction.sca
la:82) ~[lift-json_2.10-2.5-RC6.jar:2.5-RC6]
..

Q: What is wrong with my deserialization?
I serialize List[Topic] fine. Does lift/scala have problems serializing maps?

Adrian
  • 5,603
  • 8
  • 53
  • 85
  • 2
    There is a limitation of `Map` by default that requires a `String` key. This question has a solution: http://stackoverflow.com/questions/11387612/serialize-a-map-that-hasnt-a-string-as-a-key-with-lift-json – jcern Jun 18 '13 at 20:43
  • I've decided to go with Twitter's Chill library https://github.com/twitter/chill and serialize to binary – Adrian Jun 24 '13 at 19:26

0 Answers0