# KSQL Explode array of struct

**URL:** <https://forum.confluent.io/t/ksql-explode-array-of-struct/3539>\
**Category:** ksqlDB\
**Created:** [30 November 2021 11:56 UTC](https://forum.confluent.io/t/ksql-explode-array-of-struct/3539 "2021-11-30T11:56:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nko](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@nko](https://forum.confluent.io/u/nko)\
**Post date:** [30 November 2021 11:56 UTC](https://forum.confluent.io/t/ksql-explode-array-of-struct/3539/1 "2021-11-30T11:56:37Z")

</div>

Hi,  
I have my source data in this format:

```auto
{
"FIELD_1": "ABCD",
"FIELD_2": {
    "FIELD_3": "ABCD",
    "FIELD_4": [
					{
						"FIELD_5": "0000000000001",
						"FIELD_6": "01"
					},
					{
						"FIELD_5": "0000000000002",
						"FIELD_6": "02"
					}
				]
			}
}

```

I created a table with this DDL:

```auto
create table TABLE_1
(
FIELD_1 varchar, 
Object_spcId varchar, 
FIELD_2 STRUCT<FIELD_3 varchar, FIELD_4 Array<Struct<FIELD_5 varchar, FIELD_6 varchar>>>
) WITH (KAFKA_TOPIC = 'topic',
        VALUE_FORMAT='JSON');

```

How I can explode my array in order to have one row for each elemento of the array?  
I tryed to use the EXPLODE function but I have no resulto. The string “source” is returned after executing the query without any error:

`select FIELD_1, FIELD_2->FIELD_3, EXPLODE(FIELD_2->FIELD_4) from TABLE_1 where emit changes;`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [30 December 2021 11:57 UTC](https://forum.confluent.io/t/ksql-explode-array-of-struct/3539/2 "2021-12-30T11:57:09Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
