# Flattening comma separated array

**URL:** <https://matillioncommunity.discourse.group/t/flattening-comma-separated-array/2001>\
**Category:** Matillion ETL\
**Created:** [December 28, 2022, 8:01pm UTC](https://matillioncommunity.discourse.group/t/flattening-comma-separated-array/2001 "2022-12-28T20:01:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.odell1617208923357](https://sea2.discourse-cdn.com/flex002/user_avatar/matillioncommunity.discourse.group/chris.odell1617208923357/32/1105_2.png) [@chris.odell1617208923357](https://matillioncommunity.discourse.group/u/chris.odell1617208923357)\
**Post date:** [December 28, 2022, 8:01pm UTC](https://matillioncommunity.discourse.group/t/flattening-comma-separated-array/2001/1 "2022-12-28T20:01:58Z")

</div>

Hey everyone,

&nbsp;

I'm trying to figure out how to flatten the "anonymous" (no key, only values) structured data within the "trend\_in" element of the json below.

&nbsp;

Is it possible to use the Flatten Array component in a way that references only the index position of the array? For example producing a table like:

&nbsp;

pos1, pos2, pos3

1672160401,&nbsp;&nbsp;&nbsp;1672164001,&nbsp;&nbsp;&nbsp;8

1672135201,&nbsp;&nbsp;&nbsp;1672138801,&nbsp;&nbsp;&nbsp;0

... and so on

&nbsp;

&nbsp;

**Source json:**

&nbsp;

{

&nbsp;"camera\_address": "123 Main St, Parker, CO 80134, USA",

&nbsp;"camera\_id": "blahblah",

&nbsp;"camera\_name": "Int 08 (4k)",

&nbsp;"camera\_site": "CO - 204 Parker",

&nbsp;"end\_time": 1672256095,

&nbsp;"org\_id": "blahblah",

&nbsp;"org\_name": "My Company",

&nbsp;"start\_time": 1672131601,

&nbsp;"trend\_in": [

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672131601,

&nbsp;&nbsp;&nbsp;1672135201,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672135201,

&nbsp;&nbsp;&nbsp;1672138801,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672138801,

&nbsp;&nbsp;&nbsp;1672142401,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672142401,

&nbsp;&nbsp;&nbsp;1672146001,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672146001,

&nbsp;&nbsp;&nbsp;1672149601,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672149601,

&nbsp;&nbsp;&nbsp;1672153201,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672153201,

&nbsp;&nbsp;&nbsp;1672156801,

&nbsp;&nbsp;&nbsp;0

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672156801,

&nbsp;&nbsp;&nbsp;1672160401,

&nbsp;&nbsp;&nbsp;9

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672160401,

&nbsp;&nbsp;&nbsp;1672164001,

&nbsp;&nbsp;&nbsp;8

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672164001,

&nbsp;&nbsp;&nbsp;1672167601,

&nbsp;&nbsp;&nbsp;6

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672167601,

&nbsp;&nbsp;&nbsp;1672171201,

&nbsp;&nbsp;&nbsp;11

&nbsp;&nbsp;],

&nbsp;&nbsp;[

&nbsp;&nbsp;&nbsp;1672171201,

&nbsp;&nbsp;&nbsp;1672174801,

&nbsp;&nbsp;&nbsp;8

&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;

&nbsp;],

&nbsp;"type": "person"

}

---

<div class="post-metadata">

**Author:** ![ASD](https://sea2.discourse-cdn.com/flex002/user_avatar/matillioncommunity.discourse.group/asd/32/1323_2.png) [@ASD](https://matillioncommunity.discourse.group/u/ASD)\
**Post date:** [May 23, 2023, 8:57am UTC](https://matillioncommunity.discourse.group/t/flattening-comma-separated-array/2001/2 "2023-05-23T08:57:38Z")

</div>

After completing first json extract,

Have you tried using flatten command in snowflake to do this?
