Skip to content
Advertisement

Create a list of dictionaries from nested list

I do have a dynamic text that will change. I want to store those values in a meaningful way. I have created a nested list to store them but I need to convert those to individual dictionaries and store it into a list. How do I do this?

JavaScript

So far good. Devices variable is a nested list.

JavaScript

I need to convert it so that it gives this:

JavaScript

I can manually do this like below but it will not work since the length may vary so it needs to be iterated.

JavaScript

I tried

JavaScript

but it gives error.

Advertisement

Answer

Simply:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement