2017-07-02 13:10:00 +08:00
[](https://sourcegraph.com/github.com/json-iterator/go?badge)
[](http://godoc.org/github.com/json-iterator/go)
[](https://travis-ci.org/json-iterator/go)
[](https://codecov.io/gh/json-iterator/go)
2017-01-05 21:23:08 +08:00
[](https://goreportcard.com/report/github.com/json-iterator/go)
2017-07-02 13:10:00 +08:00
[](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE)
2017-07-03 10:17:02 +08:00
[](https://gitter.im/json-iterator/Lobby)
2017-01-05 21:23:08 +08:00
2017-06-26 14:28:03 +08:00
A high-performance 100% compatible drop-in replacement of "encoding/json"
2016-12-01 00:56:25 +08:00
2018-01-28 22:27:09 +08:00
You can also use thrift like JSON using [thrift-iterator ](https://github.com/thrift-iterator/go )
2017-07-31 21:49:02 +08:00
```
Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing .com
```
2017-06-06 16:54:26 +08:00
# 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/op | allocation bytes | allocation times |
2017-06-06 16:55:32 +08:00
| --- | --- | --- | --- |
2017-06-06 16:54:26 +08:00
| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op |
| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op |
| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op |
| std encode | 2213 ns/op | 712 B/op | 5 allocs/op |
| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op |
| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op |
2017-06-02 11:20:24 +08:00
# Usage
2016-12-01 00:56:25 +08:00
2017-06-02 11:20:24 +08:00
100% compatibility with standard lib
2016-12-13 01:13:15 +08:00
2017-06-02 11:20:24 +08:00
Replace
2016-12-13 01:13:15 +08:00
2017-06-02 11:20:54 +08:00
```go
2017-06-02 11:20:24 +08:00
import "encoding/json"
json.Marshal(& data)
```
2016-12-12 08:08:37 +08:00
2017-06-02 11:20:24 +08:00
with
2016-12-12 08:08:37 +08:00
2017-06-02 11:20:54 +08:00
```go
2016-12-12 08:08:37 +08:00
import "github.com/json-iterator/go"
2017-09-26 15:35:55 +08:00
var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Marshal(& data)
2016-12-12 08:08:37 +08:00
```
2017-06-02 11:20:24 +08:00
Replace
2016-12-12 08:08:37 +08:00
2017-06-02 11:20:54 +08:00
```go
2017-06-02 11:20:24 +08:00
import "encoding/json"
json.Unmarshal(input, & data)
2016-12-12 08:08:37 +08:00
```
2017-06-02 11:20:24 +08:00
with
2016-12-15 23:49:56 +08:00
2017-06-02 11:20:54 +08:00
```go
2016-12-15 23:49:56 +08:00
import "github.com/json-iterator/go"
2017-09-26 15:35:55 +08:00
var json = jsoniter.ConfigCompatibleWithStandardLibrary
json.Unmarshal(input, & data)
2016-12-15 23:49:56 +08:00
```
2017-06-18 23:42:23 +08:00
[More documentation ](http://jsoniter.com/migrate-from-go-std.html )
2016-12-12 08:08:37 +08:00
# How to get
```
go get github.com/json-iterator/go
```
# Contribution Welcomed !
2017-07-02 11:59:11 +08:00
Contributors
* [thockin ](https://github.com/thockin )
2017-07-19 00:09:50 +08:00
* [mattn ](https://github.com/mattn )
2017-07-02 11:59:11 +08:00
* [cch123 ](https://github.com/cch123 )
2017-09-17 16:07:42 +08:00
* [Oleg Shaldybin ](https://github.com/olegshaldybin )
* [Jason Toffaletti ](https://github.com/toffaletti )
2017-07-02 11:59:11 +08:00
2017-02-04 14:34:00 +08:00
Report issue or pull request, or email taowen@gmail .com, or [](https://gitter.im/json-iterator/Lobby)