title: Writing to .json.gz file using jackson object mapper
body: <p>I need to create a .json.gz file using an ArrayList</p>
  
  <pre><code>void func(ArrayList&lt;AirConfig&gt; configList)
  {
    String filePath = "abc.json.gz";
    File file = new File(filePath);
  
    ObjectMapper mapper = new ObjectMapper();
    mapper.writeValue(file, configList);
  }
  </code></pre>
  
  <p>This however dosent really work because when I try to unzip the file using the following command</p>
  
  <pre><code>gzip -cd configMasterAirport_Test.json.gz &gt; configMasterAirport_Test.json
  </code></pre>
  
  <p>I get the following error,</p>
  
  <pre><code>abc.json.gz: not in gzip format
  </code></pre>
  
  <p>How do I rewrite my code so that the a compressed json is generated but I'm still able to use the Object Mapper</p>