1
0
mirror of https://github.com/json-iterator/go.git synced 2024-12-03 08:45:22 +02:00
Commit Graph

17 Commits

Author SHA1 Message Date
allen
cd6773e694 remove quotation check for key when decoding map
we don't need to check if the key is surrounded by quotation.
In fact, the key might not be strings if we register an extension to
customize the map key encoder/decoder.It may be an integer, float, or
even a struct.
2020-05-31 18:18:48 +08:00
Sai To Yeung
8961be9c21
Map keys of custom types should serialize using MarshalText when available (#461)
* Map keys of custom types should serialize/deserialize using MarshalText/UnmarshalText when available

- this brings marshaling/unmarshaling behavior in line with encoding/json
- in general, any types that implement the interfaces from the encoding package (TextUnmarshaler, TextMarshaler, etc.) should use the provided method when available
2020-05-08 10:21:59 +08:00
Tao Wen
acfec88f7a
Merge pull request #422 from JensErat/map-invalid-type
pass nested error in compatible configuration, fixes #388
2019-12-21 11:10:28 +08:00
Tao Wen
e88512faf8
Merge pull request #423 from vano144/fix-attachments-on-stream
fix nil attachment on stream in custom encoder on sorted map
2019-12-21 11:09:53 +08:00
Aaron Beitch
f814d6c0f1 Reduce allocations in sortKeysMapEncoder
Use one buffer for all values.
2019-12-03 11:55:47 -08:00
Ivan Romanov
aba8654400 fix nil attachment on stream in custom encoder on sorted map 2019-11-28 17:39:42 +03:00
Jens Erat
a1c9557592
pass nested error in compatible configuration
When invalid types inside a map were marshalled (in general, as soon as
sorted maps have been configured), the error message has not been
propagated out of the map's `subStream`.

Also fix and re-enable the channel test, which now resembles the
behavior of `encoding/json` and tests both default and compatible
configurations.

Signed-off-by: Jens Erat <email@jenserat.de>
2019-11-22 16:56:59 +01:00
Ben Brooks
028e2ef2bd Fixes #405 - Encode nil map into null 2019-09-19 13:11:30 +01:00
Tao Wen
05d041de10 fix #313 support json marshaller type as map key 2018-10-24 23:28:41 +08:00
Tao Wen
10a568c511 fix #293 copy extensions 2018-07-22 11:51:51 +08:00
Tao Wen
ca39e5af3e suport encode map[interface{}]interface{} 2018-03-15 21:28:16 +08:00
Tao Wen
455b3f8bb8 move reflect2 from plz to modern-go 2018-02-28 17:09:30 +08:00
Tao Wen
fff342fd04 gofmt 2018-02-24 22:04:41 +08:00
Tao Wen
8d6662b81b fix #242 add CreateMapKeyEncoder and CreateMapKeyDecoder to extension spi 2018-02-24 22:04:11 +08:00
Tao Wen
99fc16a363 use reflect2 to replace reflect 2018-02-22 10:12:08 +08:00
Tao Wen
a3866383f5 support recursive struct 2018-02-21 17:59:41 +08:00
Tao Wen
3d39af6dd9 remove feature prefix 2018-02-19 23:04:25 +08:00