From 7f85b9b2153053030824e2ab5f72f3044c064621 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 25 Jun 2015 12:01:26 +0200 Subject: [PATCH] promql: add MarshalJSON method for ExprType. --- promql/ast.go | 6 ++++++ 1 file changed, 6 insertions(+) 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: