title: Kotlin - How to set Non null Object value to null?
body: <p>Am getting response in my web service as below :</p>
  
  <pre><code>"data": [
          {
      myObject:{"key1":"keyValue1","key2":"keyValue2"}
  }]
  </code></pre>
  
  <p>Now I have to make this myObject null. I am trying as below :</p>
  
  <pre><code>if (mMailModel != null &amp;&amp; mMailModel!!.myObject != null)
  {
      mMailModel!!.myObject = null
  }
  </code></pre>
  
  <p>I must have to make the <strong>myObject</strong> null.</p>
  
  <p>The line telling me that <strong>Null can not be a value of Non null type</strong> </p>
  
  <p>I have declared it at above in activity as below:</p>
  
  <pre><code>private var mMailModel: MainModel.Data?=null
  </code></pre>
  
  <p>Any suggestion ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>My model class is as below :</p>
  
  <pre><code>data class MainModel(
          @SerializedName("data")
          var data: ArrayList&lt;Data&gt;,
          @SerializedName("message")
          var message: String,
          @SerializedName("status")
          var status: Int
      ) {
          data class Data(
              @SerializedName("myObject")
              var myObject: MyObject)
              {
               data class MyObject(
                  @SerializedName("key1")
                  var key1: String,
                  @SerializedName("key2")
                  var key2: String,
               )
              }
         }
  </code></pre>