tree: 51f8ea20e2d715f36ff9ec3323d93413d5c2846d [path history] [tgz]
  1. .codecov.yml
  2. .gitignore
  3. .travis.yml
  4. adapter.go
  5. any.go
  6. any_array.go
  7. any_bool.go
  8. any_float.go
  9. any_int32.go
  10. any_int64.go
  11. any_invalid.go
  12. any_nil.go
  13. any_number.go
  14. any_object.go
  15. any_str.go
  16. any_uint32.go
  17. any_uint64.go
  18. build.sh
  19. config.go
  20. fuzzy_mode_convert_table.md
  21. Gopkg.lock
  22. Gopkg.toml
  23. iter.go
  24. iter_array.go
  25. iter_float.go
  26. iter_int.go
  27. iter_object.go
  28. iter_skip.go
  29. iter_skip_sloppy.go
  30. iter_skip_strict.go
  31. iter_str.go
  32. jsoniter.go
  33. LICENSE
  34. pool.go
  35. README.md
  36. reflect.go
  37. reflect_array.go
  38. reflect_dynamic.go
  39. reflect_extension.go
  40. reflect_json_number.go
  41. reflect_json_raw_message.go
  42. reflect_map.go
  43. reflect_marshaler.go
  44. reflect_native.go
  45. reflect_optional.go
  46. reflect_slice.go
  47. reflect_struct_decoder.go
  48. reflect_struct_encoder.go
  49. stream.go
  50. stream_float.go
  51. stream_int.go
  52. stream_str.go
  53. test.sh
vendor/github.com/json-iterator/go/README.md

Sourcegraph GoDoc Build Status codecov rcard License Gitter chat

A high-performance 100% compatible drop-in replacement of “encoding/json”

You can also use thrift like JSON using thrift-iterator

Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing.com

Benchmark

benchmark

Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go

Raw Result (easyjson requires static code generation)

ns/opallocation bytesallocation times
std decode35510 ns/op1960 B/op99 allocs/op
easyjson decode8499 ns/op160 B/op4 allocs/op
jsoniter decode5623 ns/op160 B/op3 allocs/op
std encode2213 ns/op712 B/op5 allocs/op
easyjson encode883 ns/op576 B/op3 allocs/op
jsoniter encode837 ns/op384 B/op4 allocs/op

Always benchmark with your own workload. The result depends heavily on the data input.

Usage

100% compatibility with standard lib

Replace

import "encoding/json"
json.Marshal(&data)

with

import "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Marshal(&data)

Replace

import "encoding/json"
json.Unmarshal(input, &data)

with

import "github.com/json-iterator/go"

var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Unmarshal(input, &data)

More documentation

How to get

go get github.com/json-iterator/go

Contribution Welcomed !

Contributors

Report issue or pull request, or email taowen@gmail.com, or Gitter chat