49 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
Vasily Romanov 7dcf6870f0 Merge pull request #423 from AndreiBerezin/fix-null-string
fix null after MarshalText work
2025-09-15 21:18:01 +03:00
Vladislav Bulagakov ffa0b23ade feat: Add version and commit information to easyjson generator
Closes #415
2025-09-15 11:14:50 +03:00
Andrey Berezin 9b7ae67e7e fix null after MarshalText work 2025-06-06 10:19:01 +03:00
bulletmys 7c1e3c1c97 upd github actions 2021-10-10 20:22:25 +03: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
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
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
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
Kirill Korotaev e0f67b396d Add test cases for non-escaped mode of member names 2020-04-11 19:12:49 +03:00
Kirill Korotaev 9a01c9afdb Add new -disable_members_unescape option to avoid unescaping of member names, ints, ...
Improves performance for about 15% on BenchmarkEJ_Unmarshal_M-8
2020-04-11 19:11:39 +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 39cd2e35dc fix makefile 2020-03-30 23:27:47 +03:00
GoWebProd 2d0de5a8b6 Merge branch 'master' into patch/typespec-docs 2020-03-30 23:27:08 +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
Alexandr Mayorskiy 39f83e2d0b add tests for htmlescaping 2019-10-09 11:59:07 +03:00
Aleksandr Razumov c786b9d3b6 use bin dir instead of .root
Seems like "bin" is more common for such things.
2019-08-29 18:53:33 +03:00
Aleksandr Razumov aef59a06fb fix bench-other
* Update bench-other make command
* Update benchmark dependencies
* Re-generate data_{codec,ffjson}.go as they were broken
2019-08-29 18:48:49 +03:00
Aleksandr Razumov dde7f5d748 use go modules 2019-08-29 18:26:29 +03: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
Aleksandr Petrukhin b27fccced4 [decoder] remove unnecessary reference to a pointer 2019-02-20 21:52:23 +00: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