| 124 | } |
| 125 | |
| 126 | func flattenInto(value any, prefix string, out map[string]string) { |
| 127 | switch typed := value.(type) { |
| 128 | case map[string]any: |
| 129 | for k, v := range typed { |
| 130 | next := k |
| 131 | if prefix != "" { |
| 132 | next = prefix + "." + k |
| 133 | } |
| 134 | flattenInto(v, next, out) |
| 135 | } |
| 136 | case []any: |
| 137 | for i, v := range typed { |
| 138 | next := strconv.Itoa(i) |
| 139 | if prefix != "" { |
| 140 | next = prefix + "." + strconv.Itoa(i) |
| 141 | } |
| 142 | flattenInto(v, next, out) |
| 143 | } |
| 144 | default: |
| 145 | out[prefix] = fmt.Sprintf("%v", typed) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | var intRE = regexp.MustCompile(`^-?\d+$`) |
| 150 | var floatRE = regexp.MustCompile(`^-?\d+\.\d+$`) |