Skip to content

underscores in numbers cause json output to fail #2039

@zellyn

Description

@zellyn

Describe the bug
yq has trouble serializing numbers containing underscores to json.

Version of yq: 4.44.1
Operating system: mac
Installed via: homebrew

Command
The command you ran:

echo 'foo: 12_000' | yq -o=json

Actual behavior

Error: json: error calling MarshalJSON for type *yqlib.CandidateNode: json: error calling MarshalJSON for type *yqlib.CandidateNode: strconv.ParseInt: parsing "12_000": invalid syntax

Expected behavior

{
  "foo": 12000
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions