Skip to content

Commit

Permalink
Use json.Marshal to convert interface to []byte and fix the panic (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshba authored Mar 18, 2024
1 parent c447ded commit 4a0c9a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions writer/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func treeValue(t tree.Tree) interface{} {
opts := jsondiff.DefaultJSONOptions()
opts.SkipMatches = true

before := t.Value.Change.Before.([]byte)
after := t.Value.Change.After.([]byte)
before, _ := json.Marshal(t.Value.Change.Before)
after, _ := json.Marshal(t.Value.Change.After)
_, str := jsondiff.Compare(before, after, &opts)
diff = make(map[string]interface{})
_ = json.Unmarshal([]byte(str), &diff)
Expand Down

0 comments on commit 4a0c9a2

Please sign in to comment.