title: How to specify a different name for json key while using Retrofit + Moshi
body: <p>I need to make a POST request to my backend with following json:</p>
  <pre><code>{
      start_time: 123456789
  }
  </code></pre>
  <p>I have created the below data class for the body in Retrofit request:</p>
  <pre class="lang-kotlin prettyprint-override"><code>data class MyRequestBody(
      @Json(name=&quot;start_time&quot;)
      val startTime: Long
  )
  </code></pre>
  <p>But when I check on my backend the request contains the <code>startTime</code> field instead of <code>start_time</code>. How can I change the name of this variable for json serialization?</p>
  <p><strong>Edit</strong>:
  My build.gradle:</p>
  <pre><code>implementation &quot;com.squareup.retrofit2:retrofit:2.9.0&quot;
  implementation &quot;com.squareup.retrofit2:converter-moshi:2.9.0&quot;
  </code></pre>
  <p>My api interface:</p>
  <pre class="lang-kotlin prettyprint-override"><code>internal interface RemoteTopicApi {
  
      @POST(&quot;xyz/&quot;)
      suspend fun getData(@Body body: MyRequestBody)
  
  }
  </code></pre>
  <p>Retrofit Builder:</p>
  <pre class="lang-kotlin prettyprint-override"><code>Retrofit.Builder()
      .baseUrl(BASE_URL)
      .addConverterFactory(MoshiConverterFactory.create())
      .build()
  </code></pre>