Skip to content
Advertisement

Show JSON data in table in selectbox

There is a JSON data and I have displayed each key value as a column in the table. I want to export data from JSON to each column as a selectbox. i.e. I want to show all corresponding values ​​of “country” in JSON as selectbox in COUNTRY column.

My JSON data

JavaScript

My Javascript

JavaScript

How can i edit?

Advertisement

Answer

Do you mean something like this? A loop over the keys, then a loop for all the items for each key. Finally after aggregating into array, we do a <select> element using a simple utility function.

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