I have a json file coming as:
{
"rID": "1",
"rFI": "01",
"rTN": "0011",
"rAN": "11",
"sID": "2",
"sFI": "004",
"sTN": "1002",
"sAN": "03402"
}
I am using Vue JS.
Currently if I have no API file, I am doing this as an array of objects in data as:
return
rItems: [
{ label: 'r', value: '01' },
{ label: 'rFN', value: '001' },
{ label: 'rTN', value: '00011' },
{ label: 'rAN', value: '11255' }
],
sItems: [
{ label: 's', value: '01' },
{ label: 'sFN', value: '001' },
{ label: 'sTN', value: '00011' },
{ label: 'sAN', value: '11255' }
],
and using a loop to display data, both rItems
and sItems
are in separate divs
.
like this
<div class=" v-for="item in sItems">
<span class="label">
{{ item.label}}
</span>
<span class="value">
{{ item.value }}
</span>
</div>
same for rItems
I have a separate div
.
Now I have created an API file and I want this code to be computed so I can split the json into two and create an array of objects and loop over them.