60 Commits

Author SHA1 Message Date
Nicolas S. Dade 89250dbfdd Support for json:",omitzero" tag (#429)
* add support for the json:",omitzero" tag

omitzero was added to the go stdlib encoder/json in go 1.24

* add case which omitempty missed: uintptr is encodable in json

and does accept omitempty in the go stdlib encoder/json.

* add omitzero test cases for pointer-to-"" and pointer-to-{}

(both should marshal to something in order to match stdlib json, and
they do)

* fix and add tests for the case when omitzero is combined with omitempty

Without a special case the generated code can look like

   if v != nil && v != nil {
or
   if v != "" && v != "" {

and that gets flagged by go vet (go 1.25.5)
2026-03-14 17:51:56 +03:00
Andrey Berezin 9b7ae67e7e fix null after MarshalText work 2025-06-06 10:19:01 +03:00
Artem Utkin 3229627294 Fix null key in map 2024-04-19 11:06:38 +03:00
Denis Zinovyev e33cca903c fix too many arguments in call to MarshalJSON 2021-06-15 21:44:37 +03:00
i.anferov 2cb8c451eb Duplicated json values on marshalind interfaces implementing easyjson.Marshaler 2020-07-14 17:36:35 +05:00
Kirill Korotaev 244a66fa8f Add "nocopy" json tag to return unsafe string reference
When large amounts of data are unmarshaled for immediate non long live use than
copying of strings from original buffer can be avoided and instead a
reference to the original buffer returned in the field value.

Note, if the value requires unescaping, than it will be processed as
normally done with copying.

Signed-off-by: Kirill Korotaev <kirillx@gmail.com>
2020-04-12 20:48:07 +03:00
GoWebProd 0d5e07263b Merge pull request #202 from makarchuk/better-interfaces-support
Add checks for json/easyjson marshaler/unmarshaler interfaces
2020-04-12 19:26:52 +03:00
Carlo Alberto Ferraris c124e4243f Implement optional string interning
Fixes https://github.com/mailru/easyjson/issues/191
2020-04-08 08:08:39 +09:00
GoWebProd 7db1436caf Merge branch 'master' into master 2020-03-30 23:46:53 +03:00
Anton Sulaev e17df41dc6 add interfaces to provide marshal/unmarshal logic for unknown fields in struct 2020-02-17 19:52:40 +03:00
SenseyeDeveloper 35d79224b1 remove condition "if first" when is really first from "Code generated by easyjson" 2019-06-20 13:41:30 +03:00
SenseyeDeveloper aff6f55dba Remove unused runtime code "first" mailru/easyjson#229 2019-05-28 18:38:28 +03:00
Aleksandr Petrukhin a0e09156bb [decoder] implemented encoding.Marshaler for map keys 2019-04-03 16:25:01 +00:00
Aleksandr Petrukhin 6b5a421538 [encoder] implemented encoding.Marshaler for map keys 2019-04-03 15:41:30 +00:00
Timur 82d245f54e Better support for custom interfaces. Bring all of the original checks back 2019-03-23 13:02:58 +03:00
Timur Makarchuk 63896f4315 Add checks for json/easyjson marshaler/unmarshaler interfaces 2019-01-24 11:30:54 +03:00
IncSW 09f3bc3a8f fix marshaling for uint8 custom types 2018-04-27 01:46:49 +03:00
Vasily Romanov 517203d186 Merge pull request #158 from regeda/invalid_indirect_of_pointer_on_array
fix invalid indirect of a pointer on a array
2018-03-20 16:17:58 +03:00
Vasily Romanov f594efddfa Merge pull request #156 from levigross/master
Add float string functions when requested
2018-03-11 19:19:19 +03:00
Nicolas S. Dade a06183da62 support maps with key types which have custom marshler/unmarshalers
by assuming the caller knows what they are doing and that the custom
marshler will generate JSON appropriate for a key.

The standard library's encoding/json supports these.
2018-03-06 13:50:06 -08:00
Anthony Regeda 95baeb8ee7 invalid_indirect_of_pointer_on_array fix invalid indirect of a pointer on a array 2017-12-19 13:06:15 +03:00
Levi Gross 4f31de8934 Add float string functions when requested
Signed-off-by: Levi Gross <levi@levigross.com>
2017-11-26 18:36:47 -05:00
Alexandr Kozlenkov 8008ddf9ab added tag for generate slice byte instead of Base64Bytes 2017-11-22 21:11:58 +03:00
Carlo Alberto Ferraris 1fc0600954 Merge branch 'master' into opts 2017-11-20 08:43:51 +09:00
Carlo Alberto Ferraris 4aed678bdb Merge branch 'opts' of https://github.com/CAFxX/easyjson into opts 2017-10-21 14:09:56 +05:30