Convert JSON to XLS/XLSX in Java

JSON files are widely used to keep and share the data. Most often, JSON files are used to import or export data within the web, desktop, or mobile applications. In certain cases, you have to convert the received JSON data to XLS or XLSX format programmatically. To achieve that, this article covers how to convert a JSON file to Excel XLS or XLSX in Java.

Java Library for JSON to XLS Conversion

Aspose.Cells for Java is a feature-rich library for creating and manipulating spreadsheet documents. Furthermore, it lets you convert the spreadsheet and other data files from one format to other. We will use this library to convert our JSON files to XLS or XLSX format. You can download its JAR or install it directly using the following Maven configurations.

Repository:

<repository>
	<id>AsposeJavaAPI</id>
	<name>Aspose Java API</name>
	<url>https://repository.aspose.com/repo/</url>
</repository>

Dependency:

<dependency>
	<groupId>com.aspose</groupId>
	<artifactId>aspose-cells</artifactId>
	<version>22.6</version>
</dependency>

Convert a JSON File to XLS in Java

To convert a JSON file to XLS or XLSX, you only need to load the JSON file and save it in your desired Excel format. The following are the steps to convert a JSON file to XLS format in Java.

The following code sample shows how to save a JSON file as XLS in Java.

Get a Free License

You can get a free temporary license to use Aspose.Cells for Java without evaluation limitations.

Conclusion

In this article, you have learned how to convert JSON files to XLS or XLSX programmatically in Java. The code sample has demonstrated how you can integrate JSON to XLS conversion in your Java applications. Besides, you can learn more about the Java Excel API using the documentation. Also, you can share your questions or queries via our forum.

See Also