# Handling items inside items

**URL:** <https://forums.fusetools.com/t/handling-items-inside-items/3380>\
**Category:** How-to Discussions\
**Created:** [October 8, 2015, 2:36pm UTC](https://forums.fusetools.com/t/handling-items-inside-items/3380 "2015-10-08T14:36:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaulin](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zaulin](https://forums.fusetools.com/u/zaulin)\
**Post date:** [October 8, 2015, 2:36pm UTC](https://forums.fusetools.com/t/handling-items-inside-items/3380/1 "2015-10-08T14:36:00Z")

</div>

Hi,

i have a problem while creating items inside an item:

```auto
<Each Items="{vItems}">
    <StackPanel>
      <Text Value="{name}"/>
      <StackPanel Margin="20">        
          <Each Items="{innerItem}">       
                <Text Value="{innerName}"/>       
          </Each>  
      </StackPanel>
    </StackPanel>
    </Each>

```

if i try to do it all at once it works without any problem:

```auto
vItem = Observable();
vItem.add({name: "value1", innerItem: Observable({innerName: "1"}, {innerName: "2"})});

```

but i have 2 questions:

- How to add the inner items after creating the parent one?

what i tried and didn’t work:

```auto
vItem = Observable();
vItem.add({name: "value1", innerItem: Observable()});

//something like:
vItem.value[0].innerItem.add({innerName: "1"});
vItem.value[0].innerItem.add({innerName: "2"});

```

- How to add the inner values as a JSON?

what i tried and didn’t work:

```auto
var jsonText = '{innerName: "1"},{innerName: "2"}';
vItem.add({name: "value1", innerItem: Observable(JSON.parse(jsonText))});

```

---

<div class="post-metadata">

**Author:** ![zaulin](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zaulin](https://forums.fusetools.com/u/zaulin)\
**Post date:** [October 8, 2015, 4:59pm UTC](https://forums.fusetools.com/t/handling-items-inside-items/3380/2 "2015-10-08T16:59:17Z")

</div>

answer to 1st question is:

```auto
vItem.value.getAt(0).innerItem.add({innerName: "1"});

```

but still not knowing how to solve 2nd

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [October 8, 2015, 5:09pm UTC](https://forums.fusetools.com/t/handling-items-inside-items/3380/3 "2015-10-08T17:09:26Z")

</div>

Hi!

First of all your json must be properly formed, you are missing array brackets `[]`

Second, this is how you add an array to an observable item by item:

```auto
innerItem.addRange(some_array);

```

Hope this helps 🙂

---

<div class="post-metadata">

**Author:** ![zaulin](https://avatars.discourse-cdn.com/v4/letter/z/d26b3c/32.png) [@zaulin](https://forums.fusetools.com/u/zaulin)\
**Post date:** [October 8, 2015, 8:24pm UTC](https://forums.fusetools.com/t/handling-items-inside-items/3380/4 "2015-10-08T20:24:39Z")

</div>

thnx!

i already tried with and without brackets… the part i was missing was the “addRange”
