cjson

Source code GoDoc license

cjson is a Go library to emit JSON in normal/canonical form. It also includes a convenience tool named json_canonicalize for command line usage.

import "olympos.io/encoding/cjson"

To use it, import the import path above with your favourite dependency management tool and refer to it in the files where you want to use it.

If you want to install json_canonicalize by itself, you can do so by running the following command in your terminal:

$ go get olympos.io/encoding/cjson/cmd/json_canonicalize

Usage

cjson is a library that consists of three functions: Canonicalize, NewEncoder and Marshal

NewEncoder and Marshal works like the corresponding functions in encoding/json, whereas Canonicalize takes a JSON byte slice and canonicalizes it.