I've following object and I need to access

let tempID= options._baseid; 

options->_metadata->98bb74e9-b168-4b83-8019-306af8fed977->name

However I'm unable to access this and value is always undefined.

This is my object:

enter image description here

This is the the javascript data variable. Same as the screenshot.

{
  "_parent": null,
  "_metadata": {
    "sTID": null,
    "sID": null,
    "iType": null,
    "lIDList": null,
    "lEList": null,
    "SfS": null,
    "sSrcID": null,
    "sSrcType": null,
    "98bb74e9-b168-4b83-8019-306af8fed977": {
      "id": "98bb74e9-b168-4b83-8019-306af8fed977",
      "type": 2,
      "name": "newTemplate0508"
    }
  },
  "_baseid": "98bb74e9-b168-4b83-8019-306af8fed977",
  "_sourcetype": "2"
}

2 Answers

-1
Achelous01 On

try to access as following

yourObj._metadata[yourObj._baseid].name;
-1
Sharan Mohandas On

Use the bracket notation instead of dot.

let tempID = options['_baseid']; 
options['_metadata']['98bb74e9-b168-4b83-8019-306af8fed977']['name']