【发布时间】:2020-10-15 21:16:01
【问题描述】:
我需要从 TypeScript 中的一些数据创建一个对象数组。我从 api 获得的数据格式非常糟糕,因为它只是一个大对象。
看起来像这样。
KeyBinary00: null
KeyBinary01: null
KeyBinary02: null
KeyBinary03: null
KeyBinary04: null
KeyBoolean00: "deling"
KeyBoolean01: null
KeyBoolean02: null
KeyBoolean03: null
KeyBoolean04: null
KeyDateTime00: "start"
KeyDateTime01: "slutt"
KeyDateTime02: null
KeyDateTime03: null
KeyDateTime04: null
KeyInteger00: "verdi"
KeyInteger01: null
KeyInteger02: null
KeyInteger03: null
KeyInteger04: null
KeyString00: "status"
KeyString01: "beskrivelse"
KeyString02: "leverandør"
KeyString03: "prosjektleder"
KeyString04: "prosjektnavn"
KeyString05: "tekniskPL"
KeyString06: "klasse"
KeyString07: "type"
KeyString08: "statusBeskrivelse"
KeyString09: "id"
LabelBinary00: null
LabelBinary01: null
LabelBinary02: null
LabelBinary03: null
LabelBinary04: null
LabelBoolean00: "Ekstern Deling"
LabelBoolean01: null
LabelBoolean02: null
LabelBoolean03: null
LabelBoolean04: null
LabelDateTime00: "Startdato"
LabelDateTime01: "Sluttdato"
LabelDateTime02: null
LabelDateTime03: null
LabelDateTime04: null
LabelInteger00: "Verdi"
LabelInteger01: null
LabelInteger02: null
LabelInteger03: null
LabelInteger04: null
LabelString00: "Prosjektstatus"
LabelString01: "Beskrivelse"
LabelString02: "Leverandør"
LabelString03: "Prosjektleder / KAM"
LabelString04: "Prosjektnavn"
LabelString05: "Teknisk PL"
LabelString06: "Prosjektklasse"
LabelString07: "Prosjekttype"
LabelString08: "Prosjesktstatus beskrivelse"
LabelString09: "Prosjekt"
ValueBinary00: null
ValueBinary01: null
ValueBinary02: null
ValueBinary03: null
ValueBinary04: null
ValueBoolean00: false
ValueBoolean01: null
ValueBoolean02: null
ValueBoolean03: null
ValueBoolean04: null
ValueDateTime00: "2020-01-07T00:00:00Z"
ValueDateTime01: "2021-02-10T00:00:00Z"
ValueDateTime02: null
ValueDateTime03: null
ValueDateTime04: null
ValueInteger00: 10000000
ValueInteger01: null
ValueInteger02: null
ValueInteger03: null
ValueInteger04: null
ValueString00: "Godkjennt"
ValueString01: "Dette prosjektet skal kjøpe inn."
ValueString02: "Siemens"
ValueString03: "Tom Tommerson"
ValueString04: "Innkjøp av nye leker"
ValueString05: "Adele Adelerson"
ValueString06: "Stort prosjekt"
ValueString07: "Innkjøp"
ValueString08: "En beskrivelse om status"
ValueString09: "20-12"
我需要做的是创建一个对象数组,其中所有对应的值都放在一起。
[
{
KeyBoolean00: "deling",
LabelBoolean00: "Ekstern Deling",
ValueBoolean00: false
},
{
KeyDateTime00: "start",
LabelDateTime00: "Startdato",
ValueDateTime00: "2020-01-07T00:00:00Z"
},
{
KeyString00: "status"
LabelString00: "Prosjektstatus"
ValueString00: "Godkjennt"
}
]
如果这有意义的话。 我已经尝试了一些东西,但我不知道该怎么做。
【问题讨论】:
标签: arrays typescript object