• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

any_tests/H11-Sep-2021-911748

api_tests/H11-Sep-2021-485415

benchmarks/H11-Sep-2021-314268

extension_tests/H11-Sep-2021-345296

extra/H11-Sep-2021-1,2221,061

misc_tests/H11-Sep-2021-1,7771,574

skip_tests/H11-Sep-2021-316285

type_tests/H11-Sep-2021-1,7451,555

value_tests/H11-Sep-2021-1,7651,604

.codecov.ymlH A D11-Sep-202133 42

.gitignoreH A D11-Sep-202142 54

.travis.ymlH A D11-Sep-2021159 1510

Gopkg.lockH A D11-Sep-2021588 2217

Gopkg.tomlH A D11-Sep-2021712 2724

LICENSEH A D11-Sep-20211 KiB2217

README.mdH A D11-Sep-20212.9 KiB8659

adapter.goH A D11-Sep-20214.5 KiB15194

any.goH A D11-Sep-20217 KiB326282

any_array.goH A D11-Sep-20214.7 KiB279239

any_bool.goH A D11-Sep-20211.8 KiB138103

any_float.goH A D11-Sep-20211.2 KiB8465

any_int32.goH A D11-Sep-20211.1 KiB7556

any_int64.goH A D11-Sep-20211.1 KiB7556

any_invalid.goH A D11-Sep-20211.3 KiB8362

any_nil.goH A D11-Sep-2021916 7052

any_number.goH A D11-Sep-20212.6 KiB124106

any_object.goH A D11-Sep-20216.8 KiB375311

any_str.goH A D11-Sep-20212.8 KiB167133

any_uint32.goH A D11-Sep-20211.1 KiB7556

any_uint64.goH A D11-Sep-20211.1 KiB7556

build.shH A D11-Sep-2021381 1310

config.goH A D11-Sep-202110.3 KiB376321

example_test.goH A D11-Sep-20212.6 KiB12298

fuzzy_mode_convert_table.mdH A D11-Sep-2021927 77

go.modH A D11-Sep-2021267 129

go.sumH A D11-Sep-20211.2 KiB1514

iter.goH A D11-Sep-20217.7 KiB350300

iter_array.goH A D11-Sep-20211.4 KiB6560

iter_float.goH A D11-Sep-20217.5 KiB343313

iter_int.goH A D11-Sep-20218.6 KiB347315

iter_object.goH A D11-Sep-20216.2 KiB268255

iter_skip.goH A D11-Sep-20213.3 KiB131111

iter_skip_sloppy.goH A D11-Sep-20213.2 KiB164137

iter_skip_sloppy_test.goH A D11-Sep-20213.1 KiB163154

iter_skip_strict.goH A D11-Sep-20212 KiB10090

iter_str.goH A D11-Sep-20214.7 KiB216197

jsoniter.goH A D11-Sep-2021884 191

pool.goH A D11-Sep-2021956 4333

reflect.goH A D11-Sep-20218.5 KiB338291

reflect_array.goH A D11-Sep-20212.6 KiB10592

reflect_dynamic.goH A D11-Sep-20211.4 KiB7162

reflect_extension.goH A D11-Sep-202114.2 KiB484384

reflect_json_number.goH A D11-Sep-20212.6 KiB11392

reflect_json_raw_message.goH A D11-Sep-20211.8 KiB7764

reflect_map.goH A D11-Sep-20218.9 KiB347318

reflect_marshaler.goH A D11-Sep-20215.8 KiB226201

reflect_native.goH A D11-Sep-202110.9 KiB454396

reflect_optional.goH A D11-Sep-20213.3 KiB130105

reflect_slice.goH A D11-Sep-20212.6 KiB10090

reflect_struct_decoder.goH A D11-Sep-202129.3 KiB1,0981,058

reflect_struct_encoder.goH A D11-Sep-20215.2 KiB212189

stream.goH A D11-Sep-20215.2 KiB211149

stream_float.goH A D11-Sep-20212.7 KiB11298

stream_int.goH A D11-Sep-20214.5 KiB191166

stream_str.goH A D11-Sep-20217.8 KiB373328

stream_test.goH A D11-Sep-20212.3 KiB8768

test.shH A D11-Sep-2021285 139

README.md

1[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge)
2[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go)
3[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go)
4[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go)
5[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go)
6[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE)
7[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby)
8
9A high-performance 100% compatible drop-in replacement of "encoding/json"
10
11# Benchmark
12
13![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png)
14
15Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go
16
17Raw Result (easyjson requires static code generation)
18
19|                 | ns/op       | allocation bytes | allocation times |
20| --------------- | ----------- | ---------------- | ---------------- |
21| std decode      | 35510 ns/op | 1960 B/op        | 99 allocs/op     |
22| easyjson decode | 8499 ns/op  | 160 B/op         | 4 allocs/op      |
23| jsoniter decode | 5623 ns/op  | 160 B/op         | 3 allocs/op      |
24| std encode      | 2213 ns/op  | 712 B/op         | 5 allocs/op      |
25| easyjson encode | 883 ns/op   | 576 B/op         | 3 allocs/op      |
26| jsoniter encode | 837 ns/op   | 384 B/op         | 4 allocs/op      |
27
28Always benchmark with your own workload.
29The result depends heavily on the data input.
30
31# Usage
32
33100% compatibility with standard lib
34
35Replace
36
37```go
38import "encoding/json"
39json.Marshal(&data)
40```
41
42with
43
44```go
45import jsoniter "github.com/json-iterator/go"
46
47var json = jsoniter.ConfigCompatibleWithStandardLibrary
48json.Marshal(&data)
49```
50
51Replace
52
53```go
54import "encoding/json"
55json.Unmarshal(input, &data)
56```
57
58with
59
60```go
61import jsoniter "github.com/json-iterator/go"
62
63var json = jsoniter.ConfigCompatibleWithStandardLibrary
64json.Unmarshal(input, &data)
65```
66
67[More documentation](http://jsoniter.com/migrate-from-go-std.html)
68
69# How to get
70
71```
72go get github.com/json-iterator/go
73```
74
75# Contribution Welcomed !
76
77Contributors
78
79- [thockin](https://github.com/thockin)
80- [mattn](https://github.com/mattn)
81- [cch123](https://github.com/cch123)
82- [Oleg Shaldybin](https://github.com/olegshaldybin)
83- [Jason Toffaletti](https://github.com/toffaletti)
84
85Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby)
86