Try this Object.keys(a.post)
var a = {
"post": {
"hello": {
// what's in here doesn't matter
},
"test": {
// also doesn't matter
},
}
}
console.log(Object.keys(a.post))
solved How to get the object’s name inside a object javascript [duplicate]