Home > Back-end >  react native convert string into array data
react native convert string into array data

Time:10-17

i have string like this:

'["wss://mediaslave1-dev-v2.vedax.ai/1L1g5nSOrNBr1fBWBva7","https://mediaslave1-dev-v2.vedax.ai/PMKzhcRhIEugeqowXMpc"]'

I want to convert into array, can someone help me

CodePudding user response:

const str ='["wss://mediaslave1-dev-v2.vedax.ai/1L1g5nSOrNBr1fBWBva7","https://mediaslave1-dev-v2.vedax.ai/PMKzhcRhIEugeqowXMpc"]'
const arr = JSON.parse(str);
console.log(arr);

You may use JSON.parse

  • Related