Skip to content

numberDecoder fails to parse long numbers, even with UseNumbers() enabled. #555

@atoulme

Description

@atoulme

See open-telemetry/opentelemetry-collector-contrib#41028 for origination.

The issue seems to come from folks sending overly long numbers as struct fields. Even with UseNumbers() enabled, we get an error.

This is because https://github.com/goccy/go-json/blob/master/internal/decoder/number.go#L45 performs a check:

	if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil {
		return 0, errors.ErrSyntax(err.Error(), c)
	}

Why is this check present? Is it to conform to json/encoding?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions