title: Convert a hashmap to a json string in spring-boot
body: <p>I am creating a spring-boot application and I want to be able to return the whole content of a hashmap as a json string. How do I do that?</p>
  
  <p>My hashmap looks like the following:</p>
  
  <pre><code>private static final Map&lt;String,Animal&gt; animalMap= new HashMap&lt;String,Animal&gt;();
  </code></pre>
  
  <p>The function</p>
  
  <pre><code>@RequestMapping(value="/animals", method=RequestMethod.GET)
      public String showAllAnimals() {
  
          // In here I want to return the content of my hashmap as a Json String
      }
  </code></pre>