You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/08/18 23:46:12 UTC

[GitHub] [dubbo-go-hessian2] jjhewlett edited a comment on issue #220: go-hessian2报错 error:decObject illegal object type tag:121

jjhewlett edited a comment on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675371047


   @wongoo 目前data没有被解析出来
   ![image](https://user-images.githubusercontent.com/69667512/90496512-801e0e80-e178-11ea-82ae-7b1288d3f1fd.png)
   
   ```Go
   import (
   	hessian "github.com/apache/dubbo-go-hessian2"
   	"fmt"
   )
   
   type ResponseData struct {
   	Code string
   	Msg  string
   	Data map[string]interface{}
   }
   
   
   func (ResponseData) JavaClassName() string {
   	return "com.example.dubbo_tools.domain.ResponseData"
   }
   
   func main() {
   	res := &ResponseData{}
   	res.Code = "0000"
   	res.Msg = "成功"
   
   	list := []string{"A","B","C"}
   	data := map[string]interface{}{
   		"count" : 1,
   		"data"  : list,
   	}
   	res.Data = data
   
   	e := hessian.NewEncoder()
   	err := e.Encode(res)
   	if err != nil {
   		panic(err)
   	}
   	bytes := e.Buffer()
   	decoder := hessian.NewDecoder(bytes)
   	decode, err := decoder.Decode()
   	if err != nil {
   		panic(err)
   	}
   	fmt.Println(decode)
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org