Skip to content

add option to UseNumber() in gin.Context.BindJSON() #368

Closed
@oryband

Description

When receiving a json object with number values and calling context.BindJSON() (or context.Bind()), the numbers will be unmarshalled to float64 values. If needed, this can be switched to unmarshalling into int by using json.Decoder.UseNumber(). However, BindJSON() doesn't give this control. This should be added somehow:

  • maybe a global switch, though this doesn't give per-request control.
  • maybe an additional parameter or ... parameter
  • any other idea?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions