Closed neguse closed 2 years ago
Hi. I had a problem with Encode() failing when the document contains certain value in extras. For example, the following code reproduces the problem. https://play.golang.org/p/CiO4tz0Zwpy
MarshalJSON() of type Node does bytes.Replace() to remove default and empty values from the JSONized data, but this may remove the data in the extras as well, so it may generate invalid JSON. https://github.com/qmuntal/gltf/blob/6c59e8324d6bed73c8c875ebb608a6e3fba72f8b/encode.go#L176-L199
I think it would be better to delete the field using omitempty instead of using bytes.Replace().
Thanks.
I like this approach!
Hi. I had a problem with Encode() failing when the document contains certain value in extras. For example, the following code reproduces the problem. https://play.golang.org/p/CiO4tz0Zwpy
MarshalJSON() of type Node does bytes.Replace() to remove default and empty values from the JSONized data, but this may remove the data in the extras as well, so it may generate invalid JSON. https://github.com/qmuntal/gltf/blob/6c59e8324d6bed73c8c875ebb608a6e3fba72f8b/encode.go#L176-L199
I think it would be better to delete the field using omitempty instead of using bytes.Replace().
Thanks.