How do I convert an array that has an array that has an array into a string?


lets say i have the following array (lets say its called tempArray):

“item1”: 4,
“item2”: “item2name”,
“item3”: “RANDOM”,
“items4”: {
“oneItem”: “EXAMPLE”,
“twoItem”: “EXAMPLE2”
“item1”: 10,
“item2”: “item6name”,
“item3”: “NONRANDOM”,
“items4”: {
“oneItem”: “EXAMPLE10”,
“twoItem”: “EXAMPLE11”

this array is a combination of two arrays (can be more than two) with each array containing another array “items4”.

How do i convert this array to a string and separating each item by line so it looks like this:

item1: 4
item2: item2name
item3: RANDOM
oneItem: EXAMPLE
twoItem: EXAMPLE2

item1: 10
item2: item6name
oneItem: EXAMPLE10
twoItem: EXAMPLE11

*note that the array can have more than two total arrays.

any help or tips would greatly be appreciated.