How do I turn a string to a json in Node.js?

0 votes
HTTP REST API just returned me a JSON, but of course it's a string right now. How can I turn it into a JSON?
Apr 24 in Java-Script by kartik
• 11,890 points
23 views

1 answer to this question.

0 votes

Hello Kartik,

Use the JSON function 

JSON.parse(theString)

Thank you!!

answered Apr 24 by Niroj
• 23,950 points

Related Questions In Java-Script

0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29 in Java-Script by Niroj
• 23,950 points
210 views
0 votes
1 answer

How to do API call in react js?

Hello, Use fetch method inside componentDidMount to update state: componentDidMount(){ fetch('https://dey.me/api/') ...READ MORE

answered May 18 in Java-Script by Niroj
• 23,950 points
48 views
+1 vote
1 answer

How to Check synchronously if file/directory exists in Node.js?

Hello, You can use fs.existsSync(): const fs = require("fs"); // ...READ MORE

answered May 28 in Java-Script by Niroj
• 23,950 points
28 views
0 votes
1 answer

How can we parse JSON using Node.js?

Hello @kartik, You can simply use JSON.parse. The definition of ...READ MORE

answered Apr 24 in Java-Script by Niroj
• 23,950 points
41 views
0 votes
1 answer

How can i create simple register form using html and css?

Html5 contains lots of elements using which ...READ MORE

answered Jan 31 in HTML by Niroj
• 23,950 points
403 views
0 votes
1 answer

Explain general Routing workflow between several web pages?

hii, Routing is just another way of fixing some content ...READ MORE

answered Feb 10 in Angular by Niroj
• 23,950 points
38 views
0 votes
1 answer

What are the vulnerability related to PHP Form?

Hii, The $_SERVER["PHP_SELF"] variable can be used by ...READ MORE

answered Feb 13 in PHP by Niroj
• 23,950 points
71 views
+1 vote
1 answer

How can we send message multiple time to a specific person or group in whatsapp using loop?

Hii @kartik,  This is simple task to send single ...READ MORE

answered Feb 28 in Java-Script by Niroj
• 23,950 points
250 views
0 votes
1 answer

How do I pass command line arguments to a Node.js program?

Hello @kartik, If your script is called myScript.js ...READ MORE

answered May 5 in Java-Script by Niroj
• 23,950 points
48 views
0 votes
1 answer

How to print a circular structure in a JSON-like format?

Hello, You can use util.inspect(object) in node.js. It automatically ...READ MORE

answered Apr 24 in Java-Script by Niroj
• 23,950 points
28 views