java或js如何把字符串转数组

有这样一个字符串

[["笔记本电脑|3888"],["台式电脑|2005"]]

java如何对其(整体)进行转换成数组格式的呢?
使用split分割,只会生成单个字符数组。
想返回数据给jsp,如果js有这类方法也行

img

js

img

js里这种格式可以用eval

img

瞅瞅这个行不行
https://blog.csdn.net/Mrqiang9001/article/details/112851091

这个就是数组格式啊,直接转数组,然后遍历就行

img


这样?

java

    public static void main(String[] args) {
        String tmp = "[[\"笔记本电脑|3888\"],[\"台式电脑|2005\"]]";
        String replaced = tmp.replaceAll("[\\[\\]]", "");
        String[] res = replaced.split(",");
        System.out.println(Arrays.toString(res));
    }