JSFiddle - React, Tailwind, and code Playground
by dshilkret
HTML
{"odata.metadata":"https://sbrokers.sharepoint.com/_api/$metadata#SP.ApiData.Files12","value":[{"odata.type":"SP.File","odata.id":"https://sbrokers.sharepoint.com/_api/Web/GetFileByServerRelativePath(decodedurl='/List1/K2-Masters-Program.pdf')","odata.editLink":"Web/GetFileByServerRelativePath(decodedurl='/List1/K2-Masters-Program.pdf')","CheckInComment":"","CheckOutType":2,"ContentTag":"{BA7B6EEF-12FF-4563-84BB-5B7CD43D88A9},1,1","CustomizedPageStatus":0,"ETag":"\"{BA7B6EEF-12FF-4563-84BB-5B7CD43D88A9},1\"","Exists":true,"IrmEnabled":false,"Length":"588009","Level":1,"LinkingUri":null,"LinkingUrl":"","MajorVersion":1,"MinorVersion":0,"Name":"K2-Masters-Program.pdf","ServerRelativeUrl":"/List1/K2-Masters-Program.pdf","TimeCreated":"2018-02-13T19:03:56Z","TimeLastModified":"2018-02-13T19:03:56Z","Title":null,"UIVersion":512,"UIVersionLabel":"1.0","UniqueId":"ba7b6eef-12ff-4563-84bb-5b7cd43d88a9"},{"odata.type":"SP.File","odata.id":"https://sbrokers.sharepoint.com/_api/Web/GetFileByServerRelativePath(decodedurl='/List1/eWR_Requirements.xlsx')","odata.editLink":"Web/GetFileByServerRelativePath(decodedurl='/List1/eWR_Requirements.xlsx')","CheckInComment":"","CheckOutType":2,"ContentTag":"{77621DF6-48EB-4C77-822B-DD22AACBC252},2,3","CustomizedPageStatus":0,"ETag":"\"{77621DF6-48EB-4C77-822B-DD22AACBC252},2\"","Exists":true,"IrmEnabled":false,"Length":"35688","Level":1,"LinkingUri":"https://sbrokers.sharepoint.com/List1/eWR_Requirements.xlsx?d=w77621df648eb4c77822bdd22aacbc252","LinkingUrl":"https://sbrokers.sharepoint.com/List1/eWR_Requirements.xlsx?d=w77621df648eb4c77822bdd22aacbc252","MajorVersion":1,"MinorVersion":0,"Name":"eWR_Requirements.xlsx","ServerRelativeUrl":"/List1/eWR_Requirements.xlsx","TimeCreated":"2018-02-13T19:04:01Z","TimeLastModified":"2018-02-13T19:04:01Z","Title":"","UIVersion":512,"UIVersionLabel":"1.0","UniqueId":"77621df6-48eb-4c77-822b-dd22aacbc252"}]}
JavaScript
var data = {
"GetDataResult": [{
"firstname": "firstname1",
"lastname": "lastname1"
}, {
"firstname": "firstname2",
"lastname": "lastname2"
}]
};
for (i = 0; i < data.GetDataResult.length; i++) {
console.log(data.GetDataResult[i].firstname);
console.log(data.GetDataResult[i].lastname);
};
$.each(data.GetDataResult, function(i, item) {
console.log(this.firstname);
console.log(this.lastname);
});