'[b426be49-0621-4240-821f-79bddf378e1e,c9e41cbb-b0d5-4833-bf72-0bf79ca31dcf]'
I tried using JSON.parse(string) But got Uncaught SyntaxError: Unexpected token 'b', "[b426be49-0"... is not valid JSON
I am expecting it to be :
[b426be49-0621-4240-821f-79bddf378e1e,c9e41cbb-b0d5-4833-bf72-0bf79ca31dcf]
without the strings around it.
Just split with a regexp
& then remove the empty items:
const s = '[b426be49-0621-4240-821f-79bddf378e1e,c9e41cbb-b0d5-4833-bf72-0bf79ca31dcf]'
const splitS = (s) => s.split(/[\[\],]/).filter(e => e)
console.log(splitS(s))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments