title: Kotlin Using Genrics for Dynamic Response Parsing
body: <p>I had the response structure given below</p>
  <pre><code>@JsonClass(generateAdapter = true)
  data class ResponseMessage(
      @field:Json(name = &quot;ClientID&quot;) val clientID: String,
      @field:Json(name = &quot;MessageID&quot;) val messageID: String,
      @field:Json(name = &quot;Payload&quot;) val payload: Payload,
      @field:Json(name = &quot;Timeout&quot;) val timeout: Int,
      @field:Json(name = &quot;Timestamp&quot;) val timestamp: Long,
      @field:Json(name = &quot;Type&quot;) val type: String
  )
  
  @JsonClass(generateAdapter = true)
  data class Payload(
      @field:Json(name = &quot;Action&quot;) val action: String,
      @field:Json(name = &quot;Params&quot;) val params: Params?
  )
  
  @JsonClass(generateAdapter = true)
  data class Params(
      @field:Json(name = &quot;room&quot;) val userDetails: UserDetails?,
      @field:Json(name = &quot;configuration&quot;) val configurationDetails: ConfigurationDetails?,
      @field:Json(name = &quot;category&quot;) val category: String?
  )
  </code></pre>
  <p>Here Params could be changed in response as per the requested service. However in some cases params will not required at all. How this can be done by making Params as Generic Type so that when i need UserDetails i will pass that and likewise for other params.</p>