How to get a value from json array in ionic 3


#1

hello
i want to take a value form row
i dont want to loop all data in list i want only one value
example i want to take mass number 2 which it is value soul
[
{
title: “hyundai”,
mass: “elantra”,
},
{
title: “kia”,
mass: “soul”,
},
{
title: “toyota”,
mass: “camry”,
}
]

after i take it i want to put it in href in


#2

Assuming you’ve already parsed the JSON into an array, you’d access it like any ol’ array in JS.

myArray[1].mass

As far as the href, you could something like this in your controller:
this.massLink = `http://mycoolwebsite.com/${myArray[1].mass}`;

Then in your view:
<a [href]="massLink"></a>