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

Free Support Forum - aspose.com

Include nulls in JSON export from Cells in v22.8

It seems that the latest version of Cells (2.8) removes empty cells when exporting an excel file to JSON.
version 22.7 seems to be ok.
Is this by design? Any workarounds?

@o.werker
We removed empty cells in order to reduce the size of exported json.
Could you explain why those empty cells are requested?

Because that’s the shape of my data. A null could be an indication of an error for example.
Retaining the nulls also preserves the json schema of the payload because all of the properties are still there even if their value is null (which I can handle with the schema as well)

@o.werker,

Could you please share your sample code (runnable), your template Excel file and output JSON data/file. We will check and may log appropriate ticket(s) for your issue to figure it out soon.

PS. please zip the files prior attaching.

Hi @Amjad_Sahi

Attached a sample spreadsheet and an Azure functions CS file. it is extremely simple so I don’t think you’ll have issues with running it.

The file has two columns of intereset-
Ticket organisation - An empty value in this cell denotes an error on the agent’s side
Project Number - Most should be empty but a value in this column denotes a branch in the logic that needs to be dealt with.

In both cases, it’s much easier to check for a valid vs null value as opposed to trying to figure out if the attribute is there or not.
You have to remember that if I’m parsing an excel file to JSON, most likely I’m going to do something with it in code. Maintaining the “shape” of the data is critical here (or at least makes life much easier).

I appreciate the desire to optimise the response, why not simply add a control to the ExportRangeToJsonOptions construct to allow us to decide what is the desired output for our scenario (it can default to excluding nulls).

Excel_To_Json.zip (8.3 KB)

@o.werker
we have logged a ticket with an id “CELLSNET-51810” for your issue. We will add ExportRangeToJsonOptions.ExportEmptyCells property to support it.

That’s great news! Thanks @simon.zhao

@o.werker,

You are welcome. We are also pleased to notify you that we have supported the feature and in our upcoming release Aspose.Cells v22.9 it will be included. The next release will be published in the first half of September 2022. We will notify you once the new version come out.

The issues you have found earlier (filed as CELLSNET-51810) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi