0

I have a json that contain of many layers, it's easy to take what already at the first layer but when it goes deeper, I can't use it. For example. I want to get name of the Role to use for displaying in my table.

This is my table column:

        { "data": "userName", "width": "20%" },
        { "data": "email", "width": "20%" },
        { "data": "userroles.role.name", "width": "20%" }

Edit: Link for my Json https://jsoneditoronline.org/#left=local.tanavo&right=local.huvuqa

JSON structure to which this should be applied:

JSON structure

  • seems like the `userroles` value is an array, so you would need to specify an array index in order to access the `role.name` – Moistbobo Mar 16 '21 at 09:25
  • Please may you replace the image with a text example of the JSON? A [mcve] that we can run will help immensely too. – evolutionxbox Mar 16 '21 at 09:28
  • Does this answer your question? [Convert javascript dot notation object to nested object](https://stackoverflow.com/questions/7793811/convert-javascript-dot-notation-object-to-nested-object) This suggestion may not apply entirely because you have `"data": "userroles.role.name"`, whereas `"data": "userroles[0].role.name"` would make more sense because *that* would actually match with the JSON that you have. – Peter B Mar 16 '21 at 09:31
  • I have added Json link. Also the other question does answer my problem. –  Mar 16 '21 at 09:48
  • You added a link to a local file. We still can't see it – evolutionxbox Mar 16 '21 at 09:49

0 Answers0