duanquan1876
2018-06-15 08:50
浏览 534
已采纳

Go-在json.marshal中自动将字符串值转换为int值

I have []map[string]string.Values present can be integer(in string form) "1".I want to automatically convert to int value like 1.

Example:

map1 := []map[string]string{
    {"k1": "1", "k2": "some value"},
    {"k1": "-12", "k2": "some value"},
}

I want to convert it to json like this using json.marshal

 {{"k1":1,"k2":"some value"}{"k1":-12,"k1":"some value"}}

How do I achive this.

1条回答 默认 最新

相关推荐 更多相似问题