How to parse all data in the array of JSON?

Friends,

I got one JSON value as an array like this below:

the Array output getting from web service Api is attached below 

How to select each item from that

[{"ROW":[{"LBID":"1244","CERT":"1","EVENT":"09/01/2018","PARAM1":"ANCY. U","PARAM2":"Male","PARAM3":"DAYIM. A","PARAM4":"MUHAMMAD ADHIL. D","UNIQUENO":"B0061244-1801105","STSID":"1","STSMSG":"Success"},

{"LBID":"1244","CERT":"1","EVENT":"09/01/2018","PARAM1":"ANEESA. A","PARAM2":"Male","PARAM3":"NIZAM. M","PARAM4":"ASIF. N","UNIQUENO":"B0061244-1801092","STSID":"1","STSMSG":"Success"},{"LBID":"1244","CERT":"1","EVENT":"09/01/2018","PARAM1":"Ganga . S","PARAM2":"Male","PARAM3":"Abhilash . S","PARAM4":"VAISHNAV . A. S","UNIQUENO":"B0011244-1801131","STSID":"1","STSMSG":"Success"},

{"LBID":"1244","CERT":"1","EVENT":"09/01/2018","PARAM1":"PREETHU. P. KUMAR","PARAM2":"Male","PARAM3":"VIJESH. V. S","PARAM4":"ADHIDEV. V","UNIQUENO":"B0061244-1801091","STSID":"1","STSMSG":"Success"},

{"LBID":"1244","CERT":"1","EVENT":"09/01/2018","PARAM1":"SREEJA. A","PARAM2":"Male","PARAM3":"SUNIL. S","PARAM4":"DEVAKRISHNA. S","UNIQUENO":"B0061244-1801103","STSID":"1","STSMSG":"Success"}]}]


When I try to get all value in NGFor i get only First value … Please advise a looping method to
show all values …

Thanks

Anes

the structure is a ROW, which contains an array

{ 
ROW: [
{....},
{....},

etc
]

so
var x = JSON.parse(data)
*ngFor=“let item of x.ROW”

Dear @sdetweil

while using

var x = JSON.parse(data)

Error occurs

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at http://localhost:8100/build/main.js:3578:26
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:4247:33)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
    at r.run (http://localhost:8100/build/polyfills.js:3:10143)
    at http://localhost:8100/build/polyfills.js:3:20242
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4238:33)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581) ```

Please advise

Thanks
Anes

Hi, @anespa

You can use subscribe method in your web service like this,

getReq(type) {

		return new Promise((resolve, reject) => {
			this.http.get(this.apiUrl+type).subscribe(res => {
				resolve(res.json());
			},err => {
				reject(err.json());
			});
		});
}

And now put this code in your component file,

arrayData:any;

ionViewDidLoad() {
      this.your_web_service_name.getReq(type).then(res => {
            this.arrayData = res;
      });
}

So you can use *ngFor loop like this,

*ngFor = "let item of arrayData.ROW"

the variable data should be whatever variable is holding the json after the http request completes.
you didn’t show that part of your code