github.com/clarketm/json

Drop-in replacement for Golang encoding/json with additional features.


Keywords
encoder-decoder, golang, json
License
BSD-3-Clause
Install
go get github.com/clarketm/json

Documentation

json

Mirrors golang/go Golang version

Drop-in replacement for Golang encoding/json with additional features.

Installation

$ go get -u github.com/clarketm/json

Usage

- import "encoding/json"
+ import "github.com/clarketm/json"

Same usage as Golang encoding/json.

Features

If omitempty is applied to a struct and all the children of the struct are empty, then on marshalling it will be omitted from the encoded json.

Benchmarks

name                old time/op    new time/op    delta
EncodeMarshaler-16    45.1ns ± 9%    46.1ns ±10%   ~     (p=0.224 n=20+20)

name                old alloc/op   new alloc/op   delta
EncodeMarshaler-16     4.00B ± 0%     4.00B ± 0%   ~     (all equal)

name                old allocs/op  new allocs/op  delta
EncodeMarshaler-16      1.00 ± 0%      1.00 ± 0%   ~     (all equal)

License

Refer to the Golang license. See LICENSE for more information.