Tao Wen
cbc1786a76
change slice encoder to use reflect2
2018-02-18 23:27:34 +08:00
Tao Wen
5a696808d6
fix any codec
2018-02-18 22:57:01 +08:00
Tao Wen
d8e64aa825
support TextMarshaler as map key
2018-02-18 22:49:06 +08:00
Tao Wen
577ddede74
use extension to implement configs
2018-02-18 21:14:37 +08:00
Tao Wen
43d9384d67
fix marshaler support for iface case
2018-02-18 21:05:42 +08:00
Tao Wen
2074f25bd3
use extension to implement EscapeHtml config option
2018-02-17 22:55:35 +08:00
Tao Wen
ef3038593b
check nil for interface{}
2018-02-17 22:33:09 +08:00
Tao Wen
9dafbc667f
when embedded ptr is nil, the fields should be omitted
2018-02-16 17:32:41 +08:00
Tao Wen
a7a34507ab
use reflect2 for json.Marshaler
2018-02-16 15:42:37 +08:00
Tao Wen
0e2b54800a
remove EncodeInterface
2018-02-14 15:04:23 +08:00
Tao Wen
e7c7f3b337
fix coverage
2018-02-14 14:06:32 +08:00
Tao Wen
75810179f6
remove n from stream
2018-02-14 13:58:51 +08:00
Tao Wen
6a8f9fa342
Merge branch 'float-allocs' of git://github.com/brian-brazil/go into 1.1
2018-02-14 11:37:27 +08:00
Tao Wen
24bb2eee9f
fix #236 case sensitive when both upper case and lower case presents
2018-02-14 11:33:17 +08:00
Tao Wen
64cc784089
remove special handling for field
2018-02-14 10:31:55 +08:00
Tao Wen
477be43d00
consolidate more tests
2018-02-14 10:13:34 +08:00
Tao Wen
a8708bca85
consolidate more tests
2018-02-14 08:58:59 +08:00
Tao Wen
658ff9ef15
consolidate more tests
2018-02-14 08:48:12 +08:00
Tao Wen
64c1c67885
consolidate more tests
2018-02-14 08:39:18 +08:00
Tao Wen
e3bc511e5a
consolidate more tests
2018-02-14 08:28:17 +08:00
Tao Wen
8fa357ab7b
consolidate mor tests
2018-02-13 23:49:40 +08:00
Tao Wen
761ce8cce2
consolidate more tests
2018-02-13 20:58:29 +08:00
Tao Wen
c3b6c1e845
consolidate skip tests
2018-02-13 20:41:21 +08:00
Tao Wen
0ed9de94f2
support asymmetric tests
2018-02-13 20:25:27 +08:00
Tao Wen
6fded6eb5f
consolidate struct tags tests
2018-02-13 17:22:47 +08:00
Tao Wen
dc3395f770
consolidate struct tests
2018-02-13 17:06:28 +08:00
Tao Wen
bd4e013f98
consolidate slice tests
2018-02-13 16:20:08 +08:00
Tao Wen
48a4a1e4db
consolidate map tests
2018-02-13 16:07:14 +08:00
Tao Wen
9bc223734a
consolidate marshaler tests
2018-02-13 16:00:08 +08:00
Tao Wen
eb9aeccee2
consolidate builtin tests
2018-02-13 15:48:39 +08:00
Tao Wen
28adca2a14
consolidate array test
2018-02-13 15:43:10 +08:00
Tao Wen
a9b3f36b2f
add test framework
2018-02-13 15:32:21 +08:00
Brian Brazil
1e8e785321
Remove allocs from WriteFloat32/WriteFloat64
...
The use of strconv.FormatFloat causes a string allocation,
by setting aside a reusable buffer and using strconv.AppendFloat
this can be avoided.
Before:
BenchmarkRespond-4 300 5392189 ns/op 618936 B/op 20010 allocs/op
After:
BenchmarkRespond-4 300 4713746 ns/op 139744 B/op 10 allocs/op
This benchmark is using a custom encoder that calls WriteFloat64 20k
times, which is the bulk of the work.
2018-02-07 17:30:57 +00:00
Tao Wen
002b5ae342
fix tests
2018-02-05 23:45:42 +08:00
Tao Wen
07f99a1124
fix build
2018-02-05 23:05:57 +08:00
Tao Wen
71f74dc71e
implement #230 DisallowUnknownFields option added
2018-02-05 23:03:53 +08:00
Tao Wen
7990317be5
gofmt
2018-02-05 22:45:04 +08:00
Tao Wen
9edd73f752
fix build
2018-02-05 22:26:39 +08:00
Tao Wen
3d5ee1098a
Merge branch 'master' of https://github.com/json-iterator/go
2018-02-05 21:43:52 +08:00
Tao Wen
ee8cfb7547
cache frozenConfig
2018-02-05 21:43:37 +08:00
Tao Wen
bca911dae0
Update README.md
2018-01-28 22:27:09 +08:00
Tao Wen
28452fcdec
cow cache is not same, as map read will modify the underlying map. use sync.Map for 1.9 and above, and mutex if sync.Map not available
2018-01-28 17:00:11 +08:00
Tao Wen
ea8c33040f
fix #228
2018-01-27 16:25:48 +08:00
Tao Wen
358cfc3929
Merge branch 'master' of https://github.com/json-iterator/go
2018-01-25 14:48:02 +08:00
Tao Wen
c39a632e65
fix #227 , fix empty json.Number
2018-01-25 14:47:50 +08:00
Tao Wen
e31252f2e2
Merge pull request #225 from mgood/empty-array-fix
...
Fix encoding 0-length arrays
2018-01-23 23:31:07 +08:00
Matt Good
807e4a8b20
Optimize 0-length array case
...
Instead of checking the array length in encode, this can be checked up
front in `encoderOfArray` since the array type has a fixed length
determined at compile time. So return an `emptyArrayEncoder` that simply
writes an empty array to the stream.
2018-01-22 14:03:50 -08:00
Tao Wen
e78b7e89b6
Merge branch 'master' of https://github.com/json-iterator/go
2018-01-21 20:59:32 +08:00
Tao Wen
945d1aaa19
fix #140 uintptr will no lock the address from gc
2018-01-21 20:59:18 +08:00
Matt Good
ba3857729b
Fix encoding 0-length arrays
...
The array encoder assumed that arrays had at least one value, so it
would serialize them with a zero-value for the array, such as `[0]`.
This adds a test to reproduce the issue, and updates the encoder to
write an empty array if the length is 0.
2018-01-16 11:02:03 -08:00