title: Exposed: How to parse JSON into an Entity class
body: <p>I have the following user table object &amp; entity class:</p>
  
  <pre><code>object UserTable : IntIdTable() {
      val name = varchar("name", 256)
  }
  
  class User(id: EntityID&lt;Int&gt;): IntEntity(id) {
      companion object : IntEntityClass&lt;User&gt;(UserTable)
      val name by UserTable.name
  }
  </code></pre>
  
  <p>Is there a way to use Gson (or some other library) to parse JSON
  into a <code>User</code> instance, and then insert it? From what I can tell,
  it seems like I'll have to create an intermediate <code>UserData</code> data class and then manually copy the fields over.</p>
  
  <pre><code>data class UserData {
    var id: Int?
    var name: String?
  }
  
  fun main() {
    val data = Gson().fromJson&lt;UserData&gt;("...", UserData::class.java)
    val user = User.new {
      name = data.name
    }
  }
  </code></pre>
  
  <p>It's not that bad in this contrived example, but I'm wondering if there's a dry'er approach.</p>