tree: df298b6b0067569a34a70df92b362dfdd7962057 [path history] [tgz]
  1. any_tests/
  2. api_tests/
  3. benchmarks/
  4. extension_tests/
  5. extra/
  6. misc_tests/
  7. skip_tests/
  8. type_tests/
  9. value_tests/
  10. .codecov.yml
  11. .gitignore
  12. .travis.yml
  13. adapter.go
  14. any.go
  15. any_array.go
  16. any_bool.go
  17. any_float.go
  18. any_int32.go
  19. any_int64.go
  20. any_invalid.go
  21. any_nil.go
  22. any_number.go
  23. any_object.go
  24. any_str.go
  25. any_uint32.go
  26. any_uint64.go
  27. build.sh
  28. config.go
  29. example_test.go
  30. fuzzy_mode_convert_table.md
  31. Gopkg.lock
  32. Gopkg.toml
  33. iter.go
  34. iter_array.go
  35. iter_float.go
  36. iter_int.go
  37. iter_object.go
  38. iter_skip.go
  39. iter_skip_sloppy.go
  40. iter_skip_sloppy_test.go
  41. iter_skip_strict.go
  42. iter_str.go
  43. jsoniter.go
  44. LICENSE
  45. pool.go
  46. README.md
  47. reflect.go
  48. reflect_array.go
  49. reflect_dynamic.go
  50. reflect_extension.go
  51. reflect_json_number.go
  52. reflect_json_raw_message.go
  53. reflect_map.go
  54. reflect_marshaler.go
  55. reflect_native.go
  56. reflect_optional.go
  57. reflect_slice.go
  58. reflect_struct_decoder.go
  59. reflect_struct_encoder.go
  60. stream.go
  61. stream_float.go
  62. stream_int.go
  63. stream_str.go
  64. stream_test.go
  65. 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