Если ваш JSON что-то вроде ниже и я правильно понял ваш вопрос, то это то, что должно работать для вас:
app.json
[
{ "Tag":"Location", "type": 9, "Value":"Europe" },
{ "Tag":"Location", "type": 10, "Value":"US" },
{ "Tag":"YearOfOperation", "type": 9, "Value":"2016" },
{ "Tag":"YearOfOperation", "type": 10, "Value":"2018" },
{ "Tag":"TaxId", "type": 9, "Value":"txn123" },
{ "Tag":"TaxId", "type": 10, "Value":"txn124" }
]
app.component.html
<table>
<thead><tr><th>Location</th><th>Year Of Operation</th><th>Tax ID</th></tr></thead>
<tbody>
<tr *ngFor="let product of products">
<td *ngIf="product?.Tag === 'Location'; else blankValue">{{product?.Value}}</td>
<td *ngIf="product?.Tag === 'YearOfOperation'; else blankValue">{{product?.Value}}</td>
<td *ngIf="product?.Tag === 'TaxId'; else blankValue">{{product?.Value}}</td>
</tr>
</tbody>
</table>
<ng-template #blankValue><td></td></ng-template>
app.component.ts
public products: any;
ngOnInit() {
this.getJSON().subscribe(res => {
this.products = <Array<{}>>res;
})
}
public getJSON(): Observable<any> {
return this.http.get('./images/output_test.json')
.pipe(
map(res => res),
catchError((error) => { console.error(error); return error;})
);
}
app.component.css
th {
padding:10px;
border:1px solid black;
}
td {
padding:10px;
border:1px solid black;
}