@Matthias BlommeSorry it took so long to get back to you on this, I didn't see it right away.
I looked at your examples and I'm providing an updated PI for you to look at. I wouldn't use the loop example you had, because I really, REALLY, don't like using CARDINALITY. It's a very expensive operation and that only gets worse as the size of the array increases.
The fastest way is to delete the array and recreate it. You were close on your attempt, but you were missing the IDENTITY clause, which would make it an array, rather than an empty element. I have provided a different looping construct for you to consider, if you still want to go that route.
I also do recommend creating the DOMAIN in the Environment space, if you want to keep the formatting, especially important for XML with Attributes, but I do that for all DOMAINS to make sure I'm not losing anything.
--New Test - loop
WHILE EXISTS(rTest3.array1.Item[]) DO
DELETE FIELD rTest3.array1.Item[<];
END WHILE;
--New Test - fastest
SET rTest4.array1 = null;
CREATE FIELD rTest4.array1 IDENTITY(JSON.Array) array1;
------------------------------
James E. (Jim) Berube
Technical Account Manager (TAM) - Specialist, IBM Expertise Connect, IBM Expert Labs
IBM Software
------------------------------