52 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
Neal Patel baefa5cf6e Fix decoding null values on non-pointer fields 2025-01-09 11:27:28 -08:00
Neal Patel 529b1f6f7e Fix unmarshal null to existing value 2024-12-18 21:43:31 -08:00
Alexandr Mayorskiy 6ca8fde182 add test with nested marshaler interface 2020-07-14 17:27:06 +03:00
Pavel Parshin 0c9f71dfd2 Fixed skip detection and added correct test 2020-05-10 14:08:06 +03:00
Pavel Parshin e25e66fa75 Added pragma easyjson:skip to exclude structs from generating stage
It allows manually control which struct should be skipped when using option `-all`.
2020-05-10 13:34:43 +03:00
kirillx f0a000e7a8 Previous optimisation in findStringLen has broken unescaping of \\\" sequences (#284)
* tests: don't ignore errors, verify them carefully

* fix unescaping of \\\\\" and such sequences

* tests: add Unmarshal test cases for escaped sequences
2020-04-24 20:26:02 +03:00
Alexandr Mayorskiy 3b0c433891 Revert "Don't pass field tags into nested types"
This reverts commit 9e9dfede4e.
2020-04-15 00:45:56 +03:00
Alexandr Mayorskiy 06957521cc Merge branch 'master' of git://github.com/philpearl/easyjson into philpearl-master 2020-04-12 18:10:39 +03:00
Alexandr Mayorskiy 6ea07b37bb Merge branch 'cafxx-intern' of git://github.com/CAFxX/easyjson into CAFxX-cafxx-intern 2020-04-12 17:56:50 +03:00
GoWebProd 67202f7869 Merge pull request #271 from creker/NestedOmitempty
Don't pass fields tags into nested types
2020-04-12 17:32:32 +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 2d0de5a8b6 Merge branch 'master' into patch/typespec-docs 2020-03-30 23:27:08 +03:00
creker 9e9dfede4e Don't pass field tags into nested types 2020-03-03 16:41:45 +03:00
Phil Pearl 6a9a212c94 Cope with nil pointer on marshal
Should marshal to `null` not panic. Fixes #242
2019-07-17 18:16:32 +01:00
Aleksandr Petrukhin 7169726fa7 [tests] added tests for key text marshaler 2019-04-03 16:59:05 +00:00
warnar boekkooi d3fc79bc1b Show TypeSpec docs are ignored 2019-03-28 16:09:52 +01:00
Vasily Romanov 9825584555 Merge pull request #174 from IncSW/master
fix marshaling for uint8 custom types
2018-05-31 12:57:41 +03:00
Aleksandr Petrukhin 31e0226908 [Tests] add tests for disallow_unknown_fields 2018-05-29 16:32:28 +00: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 98961de800 Merge branch 'master' into custom_map_key_type 2018-03-07 10:19:32 +03:00
Nicolas S. Dade 699d6f0801 add test of map with key with custom marshaler 2018-03-06 13:49:51 -08:00
Nicolas S. Dade 6334c0a320 add unit test of embedded types which generates broken code
which cannot be compile
2018-03-06 13:27:21 -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