Skip to content

Instantly share code, notes, and snippets.

@autocorrectoff
autocorrectoff / gist:8af1b5e673a5ed7de006d874f0646225
Created May 12, 2025 15:27
[]interface{} to []string map values
func ConvertSliceInterfacesToStrings(m map[string]any) {
for k, v := range m {
switch val := v.(type) {
case []interface{}:
allStrings := true
strs := make([]string, len(val))
for i, item := range val {
s, ok := item.(string)
if !ok {
allStrings = false