We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unicode in JSON with breaks generated XLSX and CSV (aspose-cells for java 21.9)

Dear Support Team,

I am currently facing a problem,
When I try to convert a JSON string that contains different unicodes (\u20ac => ), the .xlsx or .csv output gets corrupted.

I have workaround with a simple replace all statement which is not really a good solution I want to avoid big regular expressions.

I wonder if there is a better solution like just set the encoding correctly to utf-8 or something and handle all unicode with one line of code. Please let me now, thanks a lot.

Best regards and thanks for your help!

JSON sample:
“PLANBUDGET_FORMATIERT”: “544,00 \u20ac”,
“CVR”: 1.23

Java Code snippet:
public void generateCellsByteArray(boolean replaceUnicode, String fileName) {
String json = null;
String jsonReplacementData = null;
Workbook workbook = null;
Worksheet worksheet= null;
try {
workbook = new Workbook(FileFormatType.XLSX);
worksheet = workbook.getWorksheets().get(0);
json = getJson(“source.json”);
// Is there a better way to handle unicodes and display it correctly?
// Encoding encoding = Encoding.getUTF8(); // can i use this in some way?
// current workaround
if(json.contains("\u20ac") && replaceUnicode) {
jsonReplacementData = json.replaceAll("\\u20ac", “€”);
System.out.println("Replaced json: \n "+ jsonReplacementData);
} else {
jsonReplacementData = json;
// import json data to default worksheet starting at cell A1
JsonUtility.importData(jsonReplacementData, worksheet.getCells(), 0, 0, getLayoutOptions());
// Text alignment
handleCellStyle(worksheet, workbook);
// save file
workbook.save(getSaveFilePath(fileName, FileFormatUtil.saveFormatToExtension(FileFormatType.XLSX)), FileFormatType.XLSX);
} catch (Exception e) {

Sample project:
example_unicode.zip (35.7 KB)


Thanks for the JSON file and sample.

Please notice, I am able to reproduce the issue as you mentioned by using your JSON file data and sample. The unicode chars in JSON break the generated XLSX and CSV by default. I have logged a ticket with an id “CELLSJAVA-44414” for your issue. We will look into your issue soon.

Once we have an update on it, we will let you know.

Okay, thanks a lot.


You are welcome.


This is to inform you that your issue has been resolved. The fix will be included in our upcoming release, i.e., Aspose.Cells for Java v22.4 which is scheduled in April, 2022. You will also be informed once the next version is published.

Hi @Amjad_Sahi ,

thanks for the quick reply, will this fix also available in Aspose.Cells for Java?

The project uses this product.

Best regards


Yes, fix will be included in both .NET and JAVA versions. The next Aspose.Cells for Java v22.4 release will be published in the second week of April, 2022.

1 Like

The issues you have found earlier (filed as CELLSJAVA-44414) have been fixed in this update. This message was posted using Bugs notification tool by Peyton.Xu