I have a nested json which looks like this:
{'services':
{
'serviceA': 'OptionA',
'serviceB': 'OptionB',
'serviceC': null
},
'AttributeB': 'ValueB',
'AttributeC': 'ValueC'
}
I would like to render nested json (services) in a tabular format like this:
services option serviceA OptionA serviceB OptionB serviceC
I was trying something like this:
var myJSONObject = {'services':
{
'serviceA': 'OptionA',
'serviceB': 'OptionB',
'serviceC': null
},
'AttributeB': 'ValueB',
'AttributeC': 'ValueC'
};
for(var i = 0; i < myJSONObject.services.length; i++)
{
var product = myJSONObject.services[i];
alert(product.key);
alert(product.value);
}
This doesn't seem to help. I am guessing I am retrieving the object in an incorrect manner. Can somebody help?