migrate all JSON to new JSON encoder (#4975)

Uses new JSON encoder in #4955 for all JSON. Branched off of #4968.
This commit is contained in:
Erik Grinaker
2020-06-08 14:22:59 +02:00
committed by GitHub
parent ba3a2dde37
commit db8f1b3df3
23 changed files with 89 additions and 79 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/tendermint/tendermint/crypto"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmjson "github.com/tendermint/tendermint/libs/json"
tmos "github.com/tendermint/tendermint/libs/os"
tmproto "github.com/tendermint/tendermint/proto/types"
tmtime "github.com/tendermint/tendermint/types/time"
@@ -46,7 +47,7 @@ type GenesisDoc struct {
// SaveAs is a utility method for saving GenensisDoc as a JSON file.
func (genDoc *GenesisDoc) SaveAs(file string) error {
genDocBytes, err := cdc.MarshalJSONIndent(genDoc, "", " ")
genDocBytes, err := tmjson.MarshalIndent(genDoc, "", " ")
if err != nil {
return err
}
@@ -104,7 +105,7 @@ func (genDoc *GenesisDoc) ValidateAndComplete() error {
// GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.
func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error) {
genDoc := GenesisDoc{}
err := cdc.UnmarshalJSON(jsonBlob, &genDoc)
err := tmjson.Unmarshal(jsonBlob, &genDoc)
if err != nil {
return nil, err
}