ToStringMap converts map[any]any to a map[string]any when possible.
(val any)
| 430 | // ToStringMap converts map[any]any to a map[string]any |
| 431 | // when possible. |
| 432 | func ToStringMap(val any) any { |
| 433 | switch actual := val.(type) { |
| 434 | case map[any]any: |
| 435 | m := make(map[string]any) |
| 436 | for k, v := range actual { |
| 437 | m[ToString(k)] = ToStringMap(v) |
| 438 | } |
| 439 | return m |
| 440 | case []any: |
| 441 | mapSlice := make([]any, len(actual)) |
| 442 | for i, e := range actual { |
| 443 | mapSlice[i] = ToStringMap(e) |
| 444 | } |
| 445 | return mapSlice |
| 446 | default: |
| 447 | return actual |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | // MarshalJSON returns the JSON encoding of s. |
| 452 | func (s *Schema) MarshalJSON() ([]byte, error) { |
no test coverage detected