int to string

import (   
    "strconv"  
) 

int i = 10
 str1 := strconv.Itoa(i)  

struct to json

import (
    "encoding/json"
)

type Server struct {
    ServerName string
    ServerIP   string
}

b, err := json.Marshal(s)
if err != nil {
   fmt.Println("json err:", err)
}
fmt.Println(string(b))

未完待续

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-11-18
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-08-12
  • 2022-12-23
相关资源
相似解决方案