Skip to content

Commit

Permalink
fix nested array
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Jun 25, 2024
1 parent ddf4e54 commit f5ebf89
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/tables/CippTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,13 @@ export default function CippTable({
Object.assign(output, flatten(value, newKey))
} else {
if (Array.isArray(value)) {
value.map((item, idx) => {
Object.assign(output, flatten(item, `${newKey}[${idx}]`))
})
if (typeof value[0] === 'object') {
value.map((item, idx) => {
Object.assign(output, flatten(item, `${newKey}[${idx}]`))
})
} else {
output[newKey] = value
}
} else {
output[newKey] = value
}
Expand Down

0 comments on commit f5ebf89

Please sign in to comment.