static List<Object> parseList(String input, String key) {
List<Object> list = new ArrayList<>();
Deque<Character> stack = new ArrayDeque<>();
StringBuilder token = new StringBuilder();
for (int i = 0; i <= input.length(); i++) {
char c = (i < input.length()) ? input.charAt(i) : ',';
if (c == '(' || c == '[') stack.push(c);
else if (c == ')' || c == ']') stack.pop();
if (c == ',' && stack.isEmpty()) {
list.add(parseValueFromString(token.toString().trim(), key));
token.setLength(0);
} else {
token.append(c);
}
}
return list;
}