I have an Object with values in the following format:
[
{
NameSpace: 'furuuqu',
LocalName: 'uuurur',
ExtensionValues: 0,
FreeText: 'OEN',
'$$hashKey': 'object:291'
},
{
NameSpace: 'furuuqu',
LocalName: 'uuurur',
ExtensionValues: 1,
FreeText: 'TWO',
'$$hashKey': 'object:293'
}
]
To read the data from this, I attempted to convert it into JSON using JSON.stringify
. The resulting objects look something like this:
{"NameSpace":"furuuqu","LocalName":"uuurur","ExtensionValues":0,"FreeText":"OEN","$$hashKey":"object:291"}
{"NameSpace":"furuuqu","LocalName":"uuurur","ExtensionValues":1,"FreeText":"TWO","$$hashKey":"object:293"}
When looping through this to get the elements, each element is displayed with keys as follows:
Object.keys(extension).forEach(function(key) {
console.log(key, extension[key]);
});
0 {
1 "
2 N
3 a
4 m
5 e
If I skip the JSON.stringify
, the result is undefined
but the keys are correctly identified.
for(var ex=0; ex<Extension.length; ex++)
{
//var extension = JSON.stringify(Extension[ex]);
Object.keys(Extension[ex]).forEach(function(key) {
console.log(key, extension[key]);
});
}
NameSpace undefined
LocalName undefined
ExtensionValues undefined
FreeText undefined
$$hashKey undefined
NameSpace undefined
LocalName undefined
ExtensionValues undefined
FreeText undefined
$$hashKey undefined
Could someone please help me understand how to properly read and display the data in this scenario?