parser.go 207 B

123456789101112131415
  1. package utils
  2. import (
  3. "encoding/json"
  4. "io"
  5. )
  6. func ParseJson(body io.ReadCloser, result interface{}) {
  7. decoder := json.NewDecoder(body)
  8. err := decoder.Decode(result)
  9. if err != nil {
  10. panic(err)
  11. }
  12. }