Commit 229d752a authored by lukas.burgey's avatar lukas.burgey

Fix the use of float64 by json.Unmarshal

parent ae08b1d5
......@@ -195,15 +195,27 @@ func UnmarshalOutput(inputBytes []byte, o *Output) (err error) {
// check answer type
switch t := answer.(type) {
case bool:
break
case string:
break
case []string:
break
case int:
break
case bool:
case []int:
break
case []string:
// converting floats to ints here, as floats are _not_ intended here
case float64:
o.QuestionnaireAnswers[qName] = int(answer.(float64))
break
case []int:
case []float64:
floats := answer.([]float64)
ints := make([]int, len(floats))
for i, v := range floats {
ints[i] = int(v)
}
o.QuestionnaireAnswers[qName] = ints
break
default:
err = fmt.Errorf("QuestionnaireAnswers contains invalid answer: %v (%T)", answer, t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment