I want to convert ist of JSON objects to gzip file using JAVA
Below is my JSON file
[
{
"id": "01",
"Status": "Open",
"siteId": "01",
"siteName": "M1"
},
{
"id": "02",
"Status": "Open",
"siteId": "02",
"siteName": "M2"
},
{
"id": "03",
"Status": "Open",
"siteId": "03",
"siteName": "M3"
}
]
Code written till now:
public static void main(String args[]) throws IOException
{
final ObjectMapper objectMapper = new ObjectMapper();
String fileName = "jsonList.json";
ClassLoader classLoader = className.class.getClassLoader();
File file = new File(classLoader.getResource(fileName).getFile());
System.out.println("File Found : " + file.exists());
List<document> list = objectMapper.readValue(file,new TypeReference<List<document>>(){});
System.out.println("List of json objects");
//code to compress list of json objects (list)
}
Document class
public class document {
public String id;
public String status;
public String sideId;
public String siteName;
}
Please suggest me the code to compress the list Thanks!