Properly encode ID (for JSON)

This commit is contained in:
Denis Arh
2021-03-23 22:03:07 +01:00
parent d3c4691faa
commit 587ac403ad
+5
View File
@@ -3,6 +3,7 @@ package expr
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/cortezaproject/corteza-server/pkg/errors"
"github.com/cortezaproject/corteza-server/pkg/handle"
@@ -144,6 +145,10 @@ func (t Array) Select(k string) (TypedValue, error) {
}
}
func (t ID) MarshalJSON() ([]byte, error) {
return json.Marshal(fmt.Sprintf("%d", t.value))
}
func CastToBoolean(val interface{}) (out bool, err error) {
return cast.ToBoolE(UntypedValue(val))
}