HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JSON Get all keys from the Object</h1> <button onclick="myFunction()">Click Me</button> <script> var data = [ { "name": "Mike", "age": 36, "married": true } ] function myFunction(){ console.log(Object.keys(data[0])) } </script> <p><strong>Note</strong>: Click on the button and check your console</p> </body> </html>
OUTPUT
×

Save as Private