0
I am trying to generate an interface of a Json file but this error, what would be the error in my code?
export interface Compra {
event: string;
timestamp: number;
custom_data: number;
value: string;
key: number;
}
{"events":[{"event":"comprou-produto",
"timestamp":"2017-09-22T13:52:24.2311892-30:00",
"custom_data":[{"key":"product_name",
"value":"Pants"},
{"key":"transaction_id","value":"135154"},
{"key":"product_price","value":131}]},
{"event":"comprou",
"timestamp":"2016-09-22T13:57:31.2311892-03:00",
"revenue":250,
"custom_data":[{"key":"store_name","value":"Loja y"},{"key":"transaction_id","value":"3029384"}]},
{"event":"comprou-produto","timestamp":"2016-09-22T13:57:33.2311892-03:00","custom_data":[{"key":"product_price","value":150},{"key":"transaction_id","value":"3216545"},{"key":"product_name","value":"Shirt"}]},
{"event":"comprou-produto","timestamp":"2016-10-02T11:37:35.2300892-03:00","custom_data":[{"key":"transaction_id","value":"3409340"},{"key":"product_name","value":"Shoes"},{"key":"product_price","value":120}]},
{"event":"comprou","timestamp":"2016-10-02T11:37:31.2300892-03:00","revenue":120,"custom_data":[{"key":"transaction_id","value":"32132131"},{"key":"store_name","value":"Loja x"}]}]}`insira o código aqui`
What error are you making? * Detail I noticed, your custom_data attribute is as number, but it’s actually an object *
– Lucas Brogni
I’m trying to make this html structure:
– will stone
<span class="content-date">{purchase.timestamp}</span> <H3 class="content-sumprice">{purchase.custom_data}</H3> <H3 class="content-store">{purchase.value}}</H3>
– will stone
<div *ngFor="Let compra of Events"> <tl-compra [compra]="compra"></tl-compra> </div>
– will stone
Ta giving this error: ERROR Typeerror: Cannot read Property
– will stone