title: How can I convert Java List Object to Json with this format? (see body)
body: <p>anyone know how can I convert this Java List Object to Json?</p>
  <pre><code>List&lt;SampleObject&gt; sample = new ArrayList&lt;SampleObject&gt;();
  </code></pre>
  <p>to this format (notice that the Json is not an array)</p>
  <pre><code>{
    &quot;0&quot;: {
      &quot;firstName&quot;: &quot;&quot;,
      &quot;lastName&quot;: &quot;&quot;,
    },
    &quot;1&quot;: {
      &quot;firstName&quot;: &quot;&quot;,
      &quot;lastName&quot;: &quot;&quot;,
    }
  }
  </code></pre>
  <p>Thanks in advance. Hope you can help me :)</p>