# Can't fetch JSON Array on EACH component

**URL:** <https://forums.fusetools.com/t/cant-fetch-json-array-on-each-component/4246>\
**Category:** How-to Discussions\
**Created:** [August 15, 2017, 7:39pm UTC](https://forums.fusetools.com/t/cant-fetch-json-array-on-each-component/4246 "2017-08-15T19:39:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alutsu](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@alutsu](https://forums.fusetools.com/u/alutsu)\
**Post date:** [August 15, 2017, 7:39pm UTC](https://forums.fusetools.com/t/cant-fetch-json-array-on-each-component/4246/1 "2017-08-15T19:39:57Z")

</div>

Hi, I’m trying to fetch a JSON Object on the EACH component, but I was not successful, I can print the result on the console.log but I can’t get it on the “EACH” component.

I need to print the elements inside the “rows” array

My json:

```json
{
    "command": "SELECT",
    "rowCount": 1,
    "oid": null,
    "rows": [
        {
            "texto": "Há três anos, a cor vermelha foi eleita para lembrar a população da importância da doação de sangue. Com isso surgiu o Junho Vermelho. A escolha está ligada ao dia 14 de junho quando se celebra o Dia Mundial do Doador de Sangue, data estabelecida pela Organização Mundial da Saúde (OMS). A Hemorrede Tocantins aderiu mais uma vez ao movimento que visa incentivar e intensificar as doações de sangue em todo o Estado. Participe desta iniciativa! Seja doador de sangue e ajude a manter o equilíbrio no fluxo de funcionamento dos hospitais e a salvar vidas.",
            "titulo": "Junho Vermelho",
            "dia_inicial": "2017-06-01T03:00:00.000Z",
            "dia_final": "2017-06-30T03:00:00.000Z",
            "horario_inicial": "07:00:00",
            "horario_final": "19:00:00",
            "unidade_id": "Hemocentro Coordenador de Palmas"
        }
    ],
}

```

That’s my code:

```auto
function fetchCampanha(path, options){
	var url = encodeURI(ROOT_URL + path)

	if(options === undefined){
		options = {}
	}

	return fetch(url, options)
			.then(function(response){
				return response.json()
			})
}

function getAllCampanhas(){
	return fetchCampanha("campanhas")
}

getAllCampanhas().then(function(newCampanhas){
	campanhas = newCampanhas.rows
	console.log(campanhas[0].texto)
});

```

```auto
<Each Items="{campanhas}">
<Text Value="texto}"/>
<Text>Teste</Text>
</Each>

```

---

<div class="post-metadata">

**Author:** ![alutsu](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@alutsu](https://forums.fusetools.com/u/alutsu)\
**Post date:** [August 15, 2017, 7:51pm UTC](https://forums.fusetools.com/t/cant-fetch-json-array-on-each-component/4246/2 "2017-08-15T19:51:19Z")

</div>

SOLVED  
I used

```auto
function fetchCampanha(path, options){
	var url = encodeURI(ROOT_URL + path)

	if(options === undefined){
		options = {}
	}

	return fetch(url)
			.then(function(response){
				return response.json()
			})
			.then(function(data){
				campanhas.replaceAll(data.rows)
			})
}

fetchCampanha("campanhas");

```

and in my UX

```auto
<Each Items="{campanhas}">
<Text Value="{texto}"/>
<Text>Teste</Text>
</Each>

```
