I have a string that looks like:
const msg = " [['robot_arm', 'bc1', 'p_09_04_00'], ['operator', 'lc1', 'p_09_15_00'], ['robot_arm', 'oc1', 'p_08_17_00']]"
And I want to split it into an array of arrays of strings, I have tried to split this string as follows:
const msg_obj = new Array(JSON.parse(msg).split("["));
console.log(msg_obj);
for (let act_id in msg_obj) {
console.log(msg_obj[act_id]);
}
The problem is that I get unwanted characters/strings inside:
- Empty strings
"". - commas
,. - square bracket
].
Can you please tell me if there is a better way to split this string into an array of arrays of strings without the unwanted output? thanks in advance.