我有一個相當大的嵌套 JSON 對象要解碼。我可以將其解碼為定義良好的嵌套結構,但我見過的替代解決方案是將其解碼為空接口。從功能上講,這很好用。但我想知道在我從 JSON 解碼對象時以及在稍后將其編組為 JSON 時,是否會在幕后導致性能損失(反映)。想法?提前致謝。代碼:CustomizationData interface{} `json:"customizationData" datastore:"-"`對比CustomizationData struct { Items []struct { ID string `json:"id"` Images []struct { CustomizationState struct { Areas []struct { Height float64 `json:"height"` ID string `json:"id"` Left float64 `json:"left"` Parent struct { Height float64 `json:"height"` Left float64 `json:"left"` Top float64 `json:"top"` Width float64 `json:"width"` } `json:"parent"` Rotation float64 `json:"rotation"` Text string `json:"text"` Top float64 `json:"top"` URL string `json:"url"` Width float64 `json:"width"` } `json:"areas"` BackgroundColor string `json:"backgroundColor"` IsUserSet bool `json:"isUserSet"` Orientation float64 `json:"orientation"` } `json:"customizationState"` SpaceId string `json:"spaceId"` } `json:"images"` ProductId float64 `json:"productId"` Quantity float64 `json:"quantity"` Sku string `json:"sku"` TemplateName string `json:"templateName"` }
- 1 回答
- 0 關注
- 160 瀏覽
添加回答
舉報
0/150
提交
取消