4

有没有哪种编码格式,高效、兼容性好、支持 go 自定义序列化和反序列化?

 1 year ago
source link: https://www.v2ex.com/t/936955
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Go 编程语言

有没有哪种编码格式,高效、兼容性好、支持 go 自定义序列化和反序列化?

  craftx · 12 小时 3 分钟前 · 872 次点击
目前服务的 rpc ,都是 json rpc.
优点自然是兼容性好、一些开源结构(比如 shopspring/decimal )都自带 json 支持。
如果真的遇到奇葩的,还可以自定义序列化和反序列化。

但缺点:低效。

找替换的话,首先想到的是 protobuf 。高效是高效,无奈使用不便,兼容性是个大问题。比如时间,就不能直接 time.Time 。

看大家有没有好的替代推荐。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK