Generate persistent MD5 based hashes for maps containig json data.
Possible usecases
- comparing maps
- check if config files need to be reloaded
- persistable keys for key value stores
- ...
Use go get
to install the latest version
of the library.
> go get -v github.com/komkom/go-jsonhash
to import the package use
import "github.com/komkom/jsonhash"
f, err := os.Open("some.json")
if err != nil {
panic(err)
}
defer f.Close()
var j map[string]interface{}
dec := json.NewDecoder(f)
err := dec.Decode(&j)
if err != nil {
panic(err)
}
hashValue := jsonhash.Hash(j)
- verify that different json maps have different hashes.