Array of objects to array
Your code flattens the entire array of {} objects, indiscriminately flattening all properties. It does not mind, if there is only one single property, but it does not make sense semantically, especially if the array is named paintings.

Rather consider the resulting array a projection/mapping to a single property painting.

For a consistent array check and take only the painting property.

for (const p of paintings) {
  if ("painting" in p) {
    paintingsNew.artworks.push(p.painting);
  }
}


The extra if protects against undefined entering corrupted data.