OneCompiler

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

5 years ago by

You can use the JSON.parse() method.

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