Golang · json对象数组 转 字符串
func jsonToStr(jsons string) string { arrs := jsons arrs = strings.Replace(arrs, "]", "", -1) //替换字符 arrs = strings.Replace(arrs, "[", "", -1) //替换字符 arrs = strings.Replace(arrs, "'", "", -1) //替换字符 arrs = strings.Replace(arrs, " ", "", -1) //替换字符 arrs = strings.Replace(arrs, "\"", "", -1) //替换字符 arrs = strings.Replace(arrs, ",", "|", -1) //替换字符 return arrs }
Golang · json对象 转数组
//Golang · json对象 转数组 func jsonToArr(jsons string) []string { arrs := jsons arrs = strings.Replace(arrs, "]", "", -1) //替换字符 arrs = strings.Replace(arrs, "[", "", -1) //替换字符 arrs = strings.Replace(arrs, "'", "", -1) //替换字符 arrs = strings.Replace(arrs, " ", "", -1) //替换字符 arrs = strings.Replace(arrs, "\"", "", -1) //替换字符 arr := strings.Split(arrs, ",") return arr }
971 Views