Skip to content

proposal: encoding/json: add Number.Float32 and Number.Int32 methods #73636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evilsharpshoot opened this issue May 8, 2025 · 2 comments
Closed
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Milestone

Comments

@evilsharpshoot
Copy link

Proposal Details

Goal
This proposal suggests adding Float32() and Int32() methods to the encoding/json.Number type to simplify access to 32-bit numeric values. These additions are fully backward-compatible and improve usability when decoding JSON into smaller numeric types.

n := json.Number("42")
i32 := n.Float32()

@gopherbot gopherbot added this to the Proposal milestone May 8, 2025
@seankhliao
Copy link
Member

see #71497 , we're unlikely to make any more changes to encoding/json.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2025
@gabyhelp
Copy link

gabyhelp commented May 8, 2025

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Projects
None yet
Development

No branches or pull requests

4 participants