0

I need to set the parent object name with a variable, so whatever is the variable value, it should be the name of the object key.

I am trying to access return the child objects of a json file as below

  var parentKey = Object.keys(dirs);
  console.log(Object.keys(dirs.parentKey)); //this should return all the object inside the parent object

I tried adding {parentKey} that didnt work either. is there a way to get this working?

Luke
  • 146
  • 13

0 Answers0