Uable to convert excalidraw diagram
neeraj1892 opened this issue · comments
I am converting my diagram and facing this error. Tried to find something to resolve but no success.
Unable to parse input: json: cannot unmarshal number 6.001684190785271 into Go struct field .elements.angle of type int64
Hi @neeraj1892,
Could you perhaps provide an example file that you're trying to convert? Stripped of any sensitive data.
-Sindre
This happens when an "angle" property in the input file is a non-integer. It's easy to reproduce by rotating any element.
I can fix it by editing the JSON file, rounding any angle properties to an integer.
Without being a go expert, it seems to me a solution would be to change the struct field .alements.angle
from int64
to a floating point type, as the error message suggests.
I've finally had time to look at it, and I've implemented a fix as described by @troelsim; the struct field has been changed to float64. I've also added tests to confirm that rotated objects should now be converted successfully.
The fix is in release v0.2.0:
https://github.com/sindrel/excalidraw-converter/releases
Thanks for the feedback and detailed descriptions, and for your patience! If you're still experiencing issues, let me know.