Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Parsing a stringified array to an array

I have a component that throws the following in the backend

memberSince: [ '["2022-05-05T08:13:07.551Z","2022-06-01T08:13:07.551Z"]' ]

Is there a way to un-stringify the array content like memberSince[0].parse() or something

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use JSON.parse()

const data = {memberSince: ['["2022-05-05T08:13:07.551Z","2022-06-01T08:13:07.551Z"]']}

const result = JSON.parse(data.memberSince)

console.log(result)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading