dot.go 331 B

1234567891011121314151617181920
  1. package templates
  2. import "encoding/json"
  3. type UniversalDot struct {
  4. Content []byte
  5. AsJson interface{}
  6. }
  7. func NewUniversalDot(content []byte) *UniversalDot {
  8. return &UniversalDot{Content: content}
  9. }
  10. func (ud *UniversalDot) IsJson() bool {
  11. if nil == json.Unmarshal(ud.Content, &ud.AsJson) {
  12. return true
  13. }
  14. return false
  15. }