This repository provides a temporary drop-in replacement for github.com/json-iterator/go
to help projects migrate to newer Go versions when the upstream library is no longer maintained.
- Keep common API compatibility for migration scenarios.
- Support
jsoniter.Marshalandjsoniter.Unmarshal. - Support
jsoniter.ConfigCompatibleWithStandardLibrary. - Support
extra.RegisterFuzzyDecoders().
In your project go.mod, point imports to this module path:
require github.com/chenwaichung/jsoniter v0.0.0Then use replace to your local/internal fork if needed:
replace github.com/chenwaichung/jsoniter => /path/to/this/repopackage main
import (
"fmt"
jsoniter "github.com/chenwaichung/jsoniter"
)
type User struct {
Name string `json:"name"`
Age int `json:"age"`
}
func main() {
raw, _ := jsoniter.Marshal(User{Name: "alice", Age: 18})
var out User
_ = jsoniter.Unmarshal(raw, &out)
fmt.Println(string(raw), out.Name, out.Age)
}package main
import (
"fmt"
jsoniter "github.com/chenwaichung/jsoniter"
)
func main() {
data, _ := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(map[string]string{
"html": "<b>",
})
fmt.Println(string(data)) // {"html":"\u003cb\u003e"}
}package main
import (
"fmt"
jsoniter "github.com/chenwaichung/jsoniter"
"github.com/chenwaichung/jsoniter/extra"
)
type Payload struct {
ID int `json:"id"`
Score float64 `json:"score"`
OK bool `json:"ok"`
}
func main() {
extra.RegisterFuzzyDecoders()
var p Payload
_ = jsoniter.Unmarshal([]byte(`{"id":"42","score":"9.5","ok":"1"}`), &p)
fmt.Println(p.ID, p.Score, p.OK)
}- This is a migration-focused compatibility layer, not a full re-implementation of every upstream feature.
- Please add tests around your project's critical serialization paths during migration.
Special thanks to the original github.com/json-iterator/go project and its contributors.
This temporary compatibility fork is built to ease migration while preserving familiar APIs.
MIT. See LICENSE.