silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
183 stars 18 forks source link

Do not know how to serialize a BigInt #1536

Closed just-hello closed 7 months ago

just-hello commented 9 months ago

Describe the bug

When I use the H5Web extension on vscode and open the .h5 file, this display appears: image Here is the file I want to open: zsim.zip

axelboc commented 9 months ago

Hi @just-hello, thanks for the report!

The dataset you're trying to visualise has a very complicated compound dtype made of nested compound and array fields: image

None of H5Web's visualizations currently support such a complex structure. The Raw visualization therefore acts as a fallback that reads the dataset and tries to display it as a JSON string. The error you're seeing comes from the Raw visualization's attempt at converting the JS object provided by h5wasm (which includes BigInt numbers) into a JSON string.

This same error was previously reported in https://github.com/silx-kit/vscode-h5web/issues/30, but in that case, the dataset was simple enough that it was supposed to be supported by the Matrix visualization. It seems that the fix in #1503 was therefore not generic enough. I think I have found a better solution—I will investigate.

Note, however, that even if the Raw visualization manages to convert the dataset to a JSON string, it will likely be too big to display and your only option will be to download it as a JSON file via the toolbar (cf. screenshot below). Will this behaviour be satisfactory to you?

image

just-hello commented 9 months ago

Thank you for the explanation. A download option for JSON data would be fine.