HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Syntax</h1> <p id="point"></p> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 36, "friends": [{ "jade": { "gender": "female", "age": 25 }, "antony": { "gender": "male", "age": 35 } }] } ]function myFunction(){ document.getElementById("point").innerHTML = data[0].friends[0].jade.gender; } </script> <p><strong>Note</strong>: Click on the button to get the gender of Mike's friend Jade.</p> </body> </html>
OUTPUT
×

Save as Private