Answer the question
In order to leave comments, you need to log in
How to unmarshal a json field if it can take a different type?
I use structure
type CustomColumn struct {
ColName string `json:"ColName"`
Description string `json:"Description"`
Type string `json:"Type"`
Value interface{} `json:"Value"`
}
Answer the question
In order to leave comments, you need to log in
In the same way, unmarshalling, you just have to pull the value from interface{} into the desired type.
https://tour.golang.org/methods/16
all numbers from Json are converted to float64 when unmarshaled in interface{}. If you need an int, you will have to turn it into an int later, after pulling it out of interface{}
He wrote everything to you.
Run apt-get update
it and see what errors there are, or the GPG signature fails verification somewhere or the repository
returns 404
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question