I use a GET method to call customers API end point, I get the response with all clients listed in JSON format. Am trying to access the "username" key in each of the clients. response is like below. just copied 2 clients for case reference. Have use the foreach loop but no data comes out. I need some help on the code to access key username which has to be an email value.
[
{
"id": 1,
"userIdent": "YGSDJDF76D",
"previousIsp": "Telkom ADSL 4mbps",
"isLead": false,
"clientType": 1,
"companyName": null,
"companyRegistrationNumber": null,
"companyTaxId": null,
"companyWebsite": null,
"street1": "26 Place",
"street2": "Merebank",
"city": "Durban",
"countryId": 263,
"stateId": null,
"zipCode": "4052",
"fullAddress": "1 newark street",
"invoiceStreet1": null,
"invoiceStreet2": null,
"invoiceCity": null,
"invoiceStateId": null,
"invoiceCountryId": null,
"invoiceZipCode": null,
"invoiceAddressSameAsContact": true,
"note": null,
"sendInvoiceByPost": null,
"invoiceMaturityDays": null,
"stopServiceDue": null,
"stopServiceDueDays": null,
"organizationId": 1,
"tax1Id": null,
"tax2Id": null,
"tax3Id": null,
"registrationDate": "2019-12-21T00:00:00+0200",
"leadConvertedAt": null,
"companyContactFirstName": null,
"companyContactLastName": null,
"isActive": true,
"firstName": "Noor M C",
"lastName": "Jooma",
"username": "custmer3@gmail.com",
},
{
"id": 2,
"userIdent": 7892BC47G,
"previousIsp": null,
"isLead": false,
"clientType": 1,
"companyName": null,
"companyRegistrationNumber": null,
"companyTaxId": null,
"companyWebsite": null,
"street1": "59 Rd",
"street2": "Mbank",
"city": "urban",
"countryId": 263,
"stateId": null,
"zipCode": "4052",
"fullAddress": "new york, urban, 4052",
"invoiceStreet1": null,
"invoiceStreet2": null,
"invoiceCity": null,
"invoiceStateId": null,
"invoiceCountryId": null,
"invoiceZipCode": null,
"invoiceAddressSameAsContact": true,
"note": null,
"sendInvoiceByPost": null,
"invoiceMaturityDays": null,
"stopServiceDue": null,
"stopServiceDueDays": null,
"organizationId": 1,
"tax1Id": null,
"tax2Id": null,
"tax3Id": null,
"registrationDate": "2019-12-21T00:00:00+0200",
"leadConvertedAt": null,
"companyContactFirstName": null,
"companyContactLastName": null,
"isActive": true,
"firstName": "Ishtiyaak",
"lastName": "Hatteea",
"username": "i8596@gmail.com",
}
]