Re: Stripping [ ] from JSON arrays
[email protected] (The Doctor) Tue, 10 Jan 2023 06:03:15 -0000 (UTC)
| Newsgroups | comp.lang.php,comp.lang.javascript |
|---|---|
| Organization | NetKnow News |
| Message-ID | <[email protected]> |
In article <[email protected]>, JJ <[email protected]> wrote: >On Tue, 10 Jan 2023 01:17:47 -0000 (UTC), The Doctor wrote: >> >> How do I strip unnecessary [] ? > >I'd use array's `reduce()` for that. e.g. > >var resultObj = theArray.reduce((res, obj) => Object.assign(res, obj), {}); Will try! -- Member - Liberal International This is [email protected] Ici [email protected] Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising! Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b Birthdate: 29 Jan 1969 Redhill, Surrey, England Beware https://mindspring.com