Home
Sign Up
Sign In
The Go Programming Language
›
http://golang.org/
›
Go Playground
Go Projects
›
Revel Web Framework
Advertisement
V2EX
›
Go 编程语言
请问如何动态的将一个 slice 内的 json 串 unmarshal 到一个 slice 内的 struct 上呢
praynise
·
Mar 8, 2019
· 2856 views
This topic created in 2647 days ago, the information mentioned may be changed or developed.
小弟有一个需求,需要通过外部文件获取多个 json 字符串,放在一个[][]bytes 里面。然后将其 unmarshal 到另外一个[]struct 里面。由于 json 有很多种,需要 unmarshal 到不同的 struct 内。想咨询各位大神,有什么优雅的方式,实现一个方法,传入[][]bytes 和 interface{}(实际为各种[]struct),得到 unmarshal 后的[]struct 呢?
No Comments Yet
struct
unmarshal
JSON
slice
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
848 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 23ms ·
UTC 20:59
·
PVG 04:59
·
LAX 13:59
·
JFK 16:59
♥ Do have faith in what you're doing.
❯