I want to decode a big set of data from a (static-schema) json file. The file contains exclusively numeric data, and keys are all integers. I know how to decode this json into a struct containing fields of map[string]int
or map[string]float32
using json.Unmarshal. But I have no interest in string keys, I'd need to convert them to int somehow.
So what I'd like to know is:
- Is there a way to achieve this, .ie getting a struct containing fields of map[int]float32 type directly from decoding,
- Otherwise how to achieve this after decoding, in a memory efficient manner ?
Thanks