Currently, I am using map to show the value with key name, but JSON will change dynamically so I won't be knowing the key for the JSON array. How to access it without knowing the key of the JSON?
My Json: (But the keys will be varying)
{
"records": [{
"DATE": "15/10/2020",
"AMT": "103284",
"TAX": "8958",
"TOTAL": "112242"
},
{
"DATE": "16/10/2020",
"AMT": "2336",
"TAX": "209",
"TOTAL": "2545"
}
]
}
Current code:
{
sortedData && sortedData.length > 0 ?
sortedData.map((item, index) => {
return (
<>
<View style={{ flexDirection: 'row' }}>
<View style={styles.container2}>
<View style={styles.item}>
<Text>{item.DATE}</Text>
</View>
<View style={styles.item2}>
<Text>{item.AMT}</Text>
</View>
<View style={styles.item2}>
<Text>{item.TAX}</Text>
</View>
<View style={styles.item2}>
<Text>{item.TOTAL}</Text>
</View>
</View>
</View>
<Divider />
</>
);
}) : false
}