sudhakarinfotech
(current)
Run Code
Live Code Editor- Javascript Object From JSON String
Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Javascript Object From JSON String</title> </head> <body> <h1>Javascript Object From JSON String </h1> <p id="result"></p> <script> const users = '{"name":"Smith", "salary":45000}'; const jsObj = JSON.parse(users); document.getElementById("result").innerHTML = jsObj.name; </script> </body> </html>
Source Code Output :
Running