我有一个要求,需要将对象数组存储在变量中。对象有不同的类型。请参考以下示例:
v := [ {"name":"ravi"},
["art","coding","music","travel"],
{"language":"golang"},
{"experience":"no"}
]
注意第二个元素是字符串本身的数组。经过研究,我想到将其存储为接口类型,例如:
var v interface{} = [ {"name":"ravi"},
["art","coding","music","travel"],
{"language":"golang"},
{"experience":"no"}
]
尽管如此,我还是收到了一些我无法发现的编译错误。
杨__羊羊
元芳怎么了
相关分类