Access data object properties inside an object

So I have the following piece of code:

const Menus = wp.api.models.Post.extend({
    url: wpApiSettings.root + 'fh/v1/menus/' + path,
});

const menus = new Menus();
console.log(menus);

menus outputs the following object:
enter image description here

How would I be able to access the data: { object and it’s properties? It looks like it’s an object inside an object.

When I do console.log(menus.attribute) that works fine, but console.log(menus.attributes.data) or even console.log(menus.attributes.success) just returns a undefined answer.

I tried doing the following:

console.log(menus.attributes['data'] also with a undefined answer.

All help is appreciated!

18 thoughts on “Access data object properties inside an object”

Leave a Comment