HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Data Types</h1> <p id="point"></p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementById("point"); var data = [{ "name": "Mike", "age": 36, "married": true, "partner": null, "children": ["Joe", "Zia"], "detail": { "birth": "London", "hair": "blonde" } }] function myFunction(){ x.innerHTML = data[0].detail.birth; } </script> <p><strong>Note</strong>: This example provides all the data types suppored by JSON. By the way, click on the button to get the birth place of 'Mike.'</p> </body> </html>
OUTPUT
×

Save as Private