let data = {
rules: [
{
host: "node-microservice.local",
http: {
paths: [
{
pathType: "Prefix",
path: "/",
backend: {
service: {
name: "proxy",
port: {
number: 80
}
}
}
}
]
}
},
{
host: "node-microservice.local",
http: {
paths: [
{
pathType: "Prefix",
path: "/",
backend: {
service: {
name: "proxy",
port: {
number: 80
}
}
}
}
]
}
}
]
}
function getAllKeys(obj){
let res = []
function getKeys(obj){
for(let key in obj){
res.push(key);
if(typeof obj[key] === "object"){
getKeys(obj[key])
}
}
}
getKeys(obj);
return res;
}
let result = getAllKeys(data).filter((data) => Number.isNaN(Number(data)))
let newResult = [...new Set(result)]
console.log(newValue)