I have an object as follows:
{
"id":1,
"vol":"0.0"
"vol_per":"0.0%"
"ABC":"8.30",
"OFG":"13.85",
"SPG":"70.80"
}
from this object I want to create a array in following format.
data = [
{field:'vol',header:'VOL'},
{field:'vol_per',header:'VOL%'},
{field:'ABC',header:'ABC'},
{field:'OFG',header:'OFG'},
{field:'APG',header:'SPG'}
]
in this array, field will have value same as key of above object and header values will be similar to shown in data array. Similaryly at run time many attributes can come. How can I do that?
headervalue?"VOL"and"VOL%"come from? Do you mean something like this: Convert object to array of key–value objects like{ name: "Apple", value: "0.6" }?headerproperty have to come from somewhere. You need to be more specific if you want answers instead of guesses. Edit your post and clarify it.