    private static <T> java.util.List<T> readJsonList(MemorySegment resultPtr, com.fasterxml.jackson.core.type.TypeReference<java.util.List<T>> typeRef) throws {{ class_name }}Exception {
        try {
            if (resultPtr.equals(MemorySegment.NULL)) {
                checkLastError();
                return java.util.List.of();
            }
            String json = resultPtr.reinterpret(Long.MAX_VALUE).getString(0);
            {{ free_handle }}.invoke(resultPtr);
            return MAPPER.readValue(json, typeRef);
        } catch (Throwable e) {
            throw new {{ class_name }}Exception("FFI call failed", e);
        }
    }
