diff --git a/promql/ast.go b/promql/ast.go index fd5fb61d2..5ec7f2356 100644 --- a/promql/ast.go +++ b/promql/ast.go @@ -14,6 +14,7 @@ package promql import ( + "encoding/json" "fmt" "time" @@ -97,6 +98,11 @@ const ( ExprString ) +// MarshalJSON implements json.Marshaler. +func (et ExprType) MarshalJSON() ([]byte, error) { + return json.Marshal(et.String()) +} + func (e ExprType) String() string { switch e { case ExprNone: