title: Handling possible null values from an API if you are not sure if a value could be null
body: <pre><code>moshi 1.11.0
  </code></pre>
  <p>I have the following data class that is being populated from the sportsapidata API</p>
  <pre><code>@JsonClass(generateAdapter = true)
  data class PlayerEntity(
          @Json(name = &quot;player_id&quot;)
          val playerId: Int,
          val firstname: String,
          val lastname: String,
          val birthday: String,
          val age: Int,
          val weight: Int,
          val height: Int,
  )
  </code></pre>
  <p>The question is, the data from the API could be null for some values and wondering what is the best practice when creating the data class.</p>
  <p>Below the data is showing null for <code>weight</code> and <code>height</code>, but in other cases it could be for other values as well.</p>
  <pre><code>  &quot;data&quot;: [
      {
        &quot;player_id&quot;: 2497,
        &quot;firstname&quot;: &quot;Jay-Alistaire Frederick&quot;,
        &quot;lastname&quot;: &quot;Simpson&quot;,
        &quot;birthday&quot;: &quot;1988-12-01&quot;,
        &quot;age&quot;: 32,
        &quot;weight&quot;: 85,
        &quot;height&quot;: 180,
      },
      {
        &quot;player_id&quot;: 2570,
        &quot;firstname&quot;: &quot;Simranjit&quot;,
        &quot;lastname&quot;: &quot;Singh Thandi&quot;,
        &quot;birthday&quot;: &quot;1999-10-11&quot;,
        &quot;age&quot;: 21,
        &quot;weight&quot;: null,
        &quot;height&quot;: null,
      }]
  </code></pre>
  <p>Would it be better to have <code>nullable types</code> for all the values so that null can be assigned to them</p>
  <pre><code>@JsonClass(generateAdapter = true)
  data class PlayerEntity(
          @Json(name = &quot;player_id&quot;)
          val playerId: Int?,
          val firstname: String?,
          val lastname: String?,
          val birthday: String?,
          val age: Int?,
          val weight: Int?,
          val height: Int?,
  )
  </code></pre>