HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Extract Data</h1> <p id="point"></p> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 36 }, { "name": "Alex", "age": 30 } ]; function myFunction(){ document.getElementById("point").innerHTML = data[0]["name"]; } </script> <p><strong>Note</strong>: Click on the button to get the name of first object.</p> </body> </html>
OUTPUT
×

Save as Private