How to convert a string into JSON in Javascript?


I have a REST API, but the response I'm getting is like a string instead of JSON. Is there any way to convert a string into JSON?

1 Answer

4 years ago by

You can use the JSON.parse() method.

JSON.parse(string-data)
4 years ago by Divya