Tech Rescue
  • Home
  • Acronyms
  • Cheat-Sheets
  • User Manuals

JSON

How to convert a String into JSON object in Node.JS

Just a few days ago I needed to do this and I found this useful function. Very simple: var jsonStr = "{"firstName":"Siry", "lastName":"Mazari"}"; console.log('JSON String: %s', jsonStr); var jsonObj = JSON.parse(jsonStr); console.log('First Name: %s', jsonObj.firstName); console.log('Last Name: %s', jsonObj.lastName); The
Hector Perez Jul 18, 2016
Tech Rescue © 2025. Powered by Ghost