Skip to content

encoding/json/v2: fails to return SyntacticError on empty input #74548

Closed
@neild

Description

@neild

json.Unmarshal([]byte{}, &m) returns a bare io.ErrUnexpectedEOF, not a jsontext.SyntacticError.

This results in the v1 wrapper not converting the ErrUnexpectedEOF into the old-style error "unexpected end of JSON input", but I think the problem is in the v2 Unmarshal not returning the right error type here; it should consistently return a SyntacticError or SemanticError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions