0

I get maps such as: Map(reference -> Map(scriptRenderings -> List(Map(text -> महा-सुभाषित-सङ्ग्रहे 9979, scheme -> null, startLetter -> म)), jsonClass -> QuoteText, metre -> None, key -> महा-सुभाषित-सङ्ग्रहे9979, language -> Map(code -> UNK))) from my couchdb-lite database library.

  • I need to convert them into case classes I've defined. How do I accomplish this (preferably with lift-json, which I'm already using)?
  • And how to convert this map to a JSON object ? (Essentially reversing this.)
Community
  • 1
  • 1
vishvAs vAsuki
  • 2,421
  • 2
  • 18
  • 19
  • Stumbled upon a related question - http://stackoverflow.com/questions/6181845/how-can-i-transform-a-map-to-a-case-class-in-scala – vishvAs vAsuki Apr 18 '17 at 01:25

1 Answers1

0

I ultimately ended up converting the map to string and parsing the string to the case class:

    val jsonStr = Serialization.writePretty(jsonMap)
//    log debug jsonStr
    val quoteText = Serialization.read[QuoteText](jsonStr)
vishvAs vAsuki
  • 2,421
  • 2
  • 18
  • 19