Looking for a way to iterate through a JSON object that may or may not have properties fields, which can be null or contain various configurations. I need to display it in a code block. Below is the example JSON data:
"grade": [
{
"alias": "G1",
"id": "4d72868e-c46f-41d1-83a6-429a2421fd34",
...
...
"updatedAt": "2021-06-11T15:19:07.387Z",
"farmId": "703ab269-20f5-4dca-8687-e14de5f6a4cb"
]
}
And the desired output should look like this:
<br>
<b-row>
<b-col class="underline">My Grades</b-col>
</b-row>
<br>
<div v-if="grades.length > 0">
<b-card-group class="mb-4" v-for="grade in grades" :key="grade.id">
<b-card :title="getTitle(grade)">
<b-card-text class="list-card">
{{getProperties(grade)}}
<span style="float:right">
<b-button
class="mr-1"
v-b-modal.modalConfirmDelete
type="submit"
variant="primary"
size="sm"
>
<b-icon icon="map" size="is-small"></b-icon>
</b-button>
<b-button
class="mr-1"
type="reset"
variant="danger"
@click="actionDelete(grade.id)"
size="sm"
>
<b-icon icon="trash-fill" size="is-small"></b-icon>
</b-button>
<b-modal id="modalConfirmDelete" title="BootstrapVue">
ddd
</b-modal>
</span>
</b-card-text>
</b-card>
</b-card-group>
I have attempted different methods such as map and loops but have been unable to get the desired result due to varying property values in the JSON data. If someone could provide assistance on extracting only the properties, it would be greatly appreciated. Thank you.