Skip to content

[Go] The numeric array MarshalJSON implementation always converts values to float64, missing precision #41156

@candiduslynx

Description

@candiduslynx

Describe the bug, including details regarding any error messages, version, and platform.

int64(-5474557666971701248) won't be correctly represented via MarshalJSON as the value is first converted to float64. See this gen line:

{{ if (eq .Size "1") }}vals[i] = float64(a.values[i]) // prevent uint8 from being seen as binary data{{ else }}vals[i] = a.values[i]{{ end }}

This is present since v12 at least.
It would be great to get this both fixed & maybe backported.

Component(s)

Go

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions