diff --git a/exerr/meta.go b/exerr/meta.go index c243e0c..87ef8f7 100644 --- a/exerr/meta.go +++ b/exerr/meta.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/gin-gonic/gin" "github.com/rs/zerolog" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" @@ -612,7 +613,15 @@ func (v MetaValue) rawValueForJson() any { if v.Value.(AnyWrap).IsNil { return nil } - return v.Value.(AnyWrap).Serialize() + if v.Value.(AnyWrap).IsError { + return bson.M{"@error": true} + } + jsonobj := gin.H{} + if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonobj); err == nil { + return jsonobj + } else { + return bson.M{"type": v.Value.(AnyWrap).Type, "data": v.Value.(AnyWrap).Json} + } } if v.DataType == MDTID { if v.Value.(IDWrap).IsNil { diff --git a/goextVersion.go b/goextVersion.go index 01536da..884660c 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.248" +const GoextVersion = "0.0.249" -const GoextVersionTimestamp = "2023-08-21T15:08:35+0200" +const GoextVersionTimestamp = "2023-08-21T15:19:40+0200"