In Go Language, how do I unmarshal json to array of object?

后端 未结 2 1104
被撕碎了的回忆
被撕碎了的回忆 2021-01-02 06:12

I have the following JSON, and I want to parse it into array of class:

{
    \"1001\": {\"level\":10, \"monster-id\": 1001, \"skill-level\": 1, \"aimer-id\":         


        
2条回答
  •  星月不相逢
    2021-01-02 06:37

    Slightly off to one side - you asked for an array of objects when you needed a map

    If you need an array (actually a slice)

    http://ioblocks.blogspot.com/2014/09/loading-arrayslice-of-objects-from-json.html

提交回复
热议问题