title: Scala: convert map to case class
body: <p>Let's say I have this example case class</p>
  
  <pre><code>case class Test(key1: Int, key2: String, key3: String)
  </code></pre>
  
  <p>And I have a map</p>
  
  <pre><code>myMap = Map("k1" -&gt; 1, "k2" -&gt; "val2", "k3" -&gt; "val3")
  </code></pre>
  
  <p>I need to convert this map to my case class in several places of the code, something like this: </p>
  
  <pre><code>myMap.asInstanceOf[Test]
  </code></pre>
  
  <p>What would be the easiest way of doing that? Can I somehow use implicit for this?</p>