title: How to change the formatting of the output of Hibernate HQL query
body: <p>I'm developing a Spring Boot application with Spring Data JPA. I'm using a custom JPQL query to group by some field and get the count. Following is my repository method.</p>
  <pre><code>@Query(&quot;SELECT v.status.name, count(v) as cnt FROM Pet v GROUP BY v.status.name&quot;)
  List&lt;Object[]&gt; countByStatus();
  </code></pre>
  <p>It's working and result is obtained as follows:</p>
  <pre><code>[
      [
          &quot;pending&quot;,
          1
      ],
      [
          &quot;available&quot;,
          4
      ]
  ]
  </code></pre>
  <p>However, I would like my Rest endpoint to respond with an output which is formatted like this</p>
  <pre><code>{
      &quot;pending&quot;: 1,
      &quot;available&quot;: 4
  }
  </code></pre>
  <p>How can I achieve this?</p>