Advertisement
728x90
When receiving the data from a web server, the data is always in a string format. But you can convert this string value to a javascript object using parse() method.
javascript
1var userString = '{"name":"John","age":31}';
2
3var userJSON = JSON.parse(userString);
4
5console.log(userJSON); // {name: "John", age: 31}Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 31
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
115of476