(array JsonArray, index int)
| 37 | } |
| 38 | |
| 39 | func GetItem[T any](array JsonArray, index int) (T, errors.Error) { |
| 40 | if index < 0 || index >= len(array) { |
| 41 | return *new(T), errors.Default.New(fmt.Sprintf("Index %d out of range", index)) |
| 42 | } |
| 43 | return Convert[T](array[index]) |
| 44 | } |
| 45 | |
| 46 | // Convert converts value to type T. If value is a slice, it converts each element of the slice to type T. |
| 47 | // Does not support nested slices. |