How to convert Map with nested Map (with key contains name of nested case clas) to case class.
Assuming we have:
case class OuterClass(fieldName1: String, fieldName2: InnerClass)
case class InnerClass(innerFieldName: Int)
How to convert:
Map("fieldName1" -> "stringValue",
"name" -> "ClassName",
"fieldName2" -> Map(
"innerFieldName" -> "value",
"innerClassName" -> "CaseClassName"))
to the
OuterClass("stringValue", InnerClass("value"))
?
Aucun commentaire:
Enregistrer un commentaire