I have a .json file like this:
{
    "width": 700,
    "height": 1382,
    "dataID": {
      "id1": "54321",
      "id2": "12345"
    }
}
I need to get value of id1 or id2 keys dynamically (using a variable). I use Cypress function cy.read() and by using definite strings it works good:
  cy.readFile(pathToConfigFile).then(($file) => {
  const id1value = $file.dataID.id1;
});
But how to wrap this expression into variable containing id1?
 
    