4 Commits

Author SHA1 Message Date
waterWang
04a7275c71 fix: support time_format tag in JSON binding (ShouldBindJSON)
The time_format struct tag works for form/query binding but is completely
ignored when binding via JSON (ShouldBindJSON). This commit adds support
for time_format, time_utc, and time_location tags in the JSON binding path.

When a struct has time.Time fields with time_format tags, the JSON decoder
falls back to mappingByPtr with a jsonSource setter that uses setTimeField
to parse the string value with the custom format. For structs without
time_format tags, the original fast path (direct JSON unmarshal) is used,
preserving full backward compatibility.

Fixes #2170
2026-07-29 20:14:35 +08:00
Tim
688a429d19
feat: support custom json codec at runtime (#3391)
* refactor(json): export json codec

* feat(json): support custom json codec at runtime

* chore(copyright): update copyright to 2025 gin core team

* docs(gin): add custom json codec examples in doc file
2025-06-16 23:16:36 +08:00
Alessandro (Ale) Segala
65ed60ed13
Allow bind with a map[string]string (#2484)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-10-31 07:20:47 +08:00
Dmitry Kutakov
f7becac7bc Relocate binding body tests (#2086)
* Relocate binding body tests

Every test file should be related to a tested file.
Remove useless tests.

* Add github.com/stretchr/testify/require package
2019-10-10 16:58:31 +08:00