go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.41k stars 1.31k forks source link

Support json.RawMessage type for JSON validation #1083

Closed sahidvelji closed 1 year ago

sahidvelji commented 1 year ago

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

Enhancement

For the baked in validation for JSON, I would like to see json.RawMessage supported as a valid type. Currently, only string seems to be supported as per the IsJSON function. I see this as a reasonable use case because a variable having type json.RawMessage does not necessarily imply that this variable is valid JSON.

Vesquen commented 1 year ago

https://github.com/go-playground/validator/pull/1110

sahidvelji commented 1 year ago

Closing this since #1110 was merged. Thanks @Vesquen.