func (m DIDCommMsgMap) MarshalJSON() ([]byte, error) {
	if m != nil {
		metadata := m[jsonMetadata]
		delete(m, jsonMetadata)
		defer func() { m[jsonMetadata] = metadata }()
	}
	return json.Marshal(map[string]interface{}(m))
}
MarshalJSON implements the json.Marshaler interface.
package service
import (
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"reflect"
	"strings"
	"time"
	"github.com/mitchellh/mapstructure"
	"github.com/hyperledger/aries-framework-go/pkg/doc/did"
)
const (
	jsonIDV1           = "@id"
	jsonIDV2           = "id"
	jsonTypeV1         = "@type"
	jsonTypeV2         = "type"
	jsonThread         = "~thread"
	jsonThreadID       = "thid"
	jsonParentThreadID = "pthid"
	jsonMetadata       = "_internal_metadata"
	basePIURI = "https://didcomm.org/"
	oldPIURI  = "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/"
)
type Version string
const (
	V1 Version = "v1"
	V2 Version = "v2"
)
type Metadata struct {
	Payload map[string]interface{} `json:"_internal_metadata,omitempty"`
}
type DIDCommMsgMap map[string]interface{}
func (m *DIDCommMsgMap) UnmarshalJSON(b []byte) error {
	defer func() {
		if (*m) != nil {
			(*m)[jsonMetadata] = map[string]interface{}{}
		}
	}()
	return json.Unmarshal(b, (*map[string]interface{})(m))
}