# Golang struct with Protobuf Data coverting issues

**URL:** <https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409>\
**Category:** Community Support\
**Tags:** go-sdk, data-converter\
**Created:** [June 16, 2021, 9:22pm UTC](https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409 "2021-06-16T21:22:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/steven_sun/32/29_2.png) [@Steven\_Sun](https://community.temporal.io/u/Steven_Sun)\
**Post date:** [June 16, 2021, 9:22pm UTC](https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409/1 "2021-06-16T21:22:59Z")

</div>

We have golang struct like below, in the MetricsValues SLAMetrics is a protobuf object,

```auto
type ExecutionResult struct {
	// Unique identifier.
	Id *RunId
	// Represents an id in the Falcon for test run.
	ExecutionId string
	// SLAMetrics values from the run.
	MetricsValues map[*metric.SLAMetric]int32
}

```

by using the default converter from go sdk we are getting errors like this:  
`Error values[0]: unable to encode: json: unsupported type: map[*pbsla_metric.SLAMetric]int32`

Since this should be a pretty common case for data converter, are we going to support this case in the sdk/converter?

---

<div class="post-metadata">

**Author:** ![Steven\_Sun](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/steven_sun/32/29_2.png) [@Steven\_Sun](https://community.temporal.io/u/Steven_Sun)\
**Post date:** [June 16, 2021, 9:33pm UTC](https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409/2 "2021-06-16T21:33:10Z")

</div>

@alex since I saw you worked on gosdk converter.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [June 17, 2021, 1:53am UTC](https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409/3 "2021-06-17T01:53:29Z")

</div>

The provided data converters don’t support mixed go/proto structures. Either make the whole `ExecutionResult` a protobuf or change `SLAMetric` to a Go struct.

Another option is to write your own DataConverter that supports such mixed structures.

---

<div class="post-metadata">

**Author:** ![alex](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/alex/32/15_2.png) [@alex](https://community.temporal.io/u/alex)\
**Post date:** [June 21, 2021, 11:01pm UTC](https://community.temporal.io/t/golang-struct-with-protobuf-data-coverting-issues/2409/4 "2021-06-21T23:01:39Z")

</div>

Yes, Maxim is right. Default data converter just check every parameter or return value, and if it is proto – uses proto JSON. We don’t reflect input or result structs themselves. Yes, it is possible but we don’t want to go into this business. You can create your own `DataConverter` though and handle only your specific case there (based on name for example) or make it generic.

Another option would be to split this `struct` to 3 parameters and wrap `map` inside some proto message like `MetricsValues` (parameter must implement [proto.Message](https://github.com/temporalio/sdk-go/blob/80e324b116270ff91521c7afd9ec85a0b242384c/converter/proto_json_payload_converter.go#L76).
