JSON marshals a to JSON and returns its hex-encoded hash.
(a any)
| 51 | |
| 52 | // JSON marshals a to JSON and returns its hex-encoded hash. |
| 53 | func JSON(a any) (string, error) { |
| 54 | b, err := json.Marshal(a) |
| 55 | if err != nil { |
| 56 | return "", redact.Errorf("marshal to json for hashing: %v", err) |
| 57 | } |
| 58 | return Bytes(b), nil |
| 59 | } |
| 60 | |
| 61 | // JSONFile compacts the JSON in a file and returns its hex-encoded hash. |
| 62 | func JSONFile(path string) (string, error) { |