1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package provider import ( "encoding/json" "reflect" ) func JSONRawDataEqual(a, b json.RawMessage) (bool, error) { var j, j2 interface{} if err := json.Unmarshal([]byte(a), &j); err != nil { return false, err } if err := json.Unmarshal([]byte(b), &j2); err != nil { return false, err } return reflect.DeepEqual(j2, j), nil }