Search code snippets, questions, articles...

Get all keys from an object using Javascript

You can use Object.keys() method to get all keys from an object. It will return the array of key names.
var obj = {
    "name": "Ankit",
    "username": "ankit01",
    "status": "active",
    "contact": "mail"

var all_keys = Object.keys(obj);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

Live Demo

Search Index Data (The code snippet can also be found with below search text)

Object.keys javascript
Was this helpful?