I have a python script that spews a stringified Set of strings:
let mySet = "{\"apple\",\"pear\",\"berry\"}"
How can I parse it back into a Set using javascript?
I tried:
eval(mySet)
new Set(mySet)
I have a python script that spews a stringified Set of strings:
let mySet = "{\"apple\",\"pear\",\"berry\"}"
How can I parse it back into a Set using javascript?
I tried:
eval(mySet)
new Set(mySet)
Try this:
let str = '{\\"apple\\",\\"pear\\",\\"berry\\"}';
let arr = str.match(/[a-zA-Z]*/g).filter((item) => item);
const newset = new Set([...arr]);
console.log(newset);