Skip to content

Instantly share code, notes, and snippets.

@nsdevaraj
Last active April 24, 2019 10:33
Show Gist options
  • Save nsdevaraj/9824ea1a10290834b131c096475aea09 to your computer and use it in GitHub Desktop.
Save nsdevaraj/9824ea1a10290834b131c096475aea09 to your computer and use it in GitHub Desktop.
copy json from zoho
var output={};
temp1.forEach(function(objs,index){
var i = index;
var outputDays={};
for (var key in temp1[i]) {
// skip loop if the property is from prototype
if (!temp1[i].hasOwnProperty(key)) continue;
var obj = temp1[i][key];
if(obj['dayStatus'] == 'P'){
var otdt=obj.hrsStatus.split('/')[1];
if(otdt) otdt.indexOf('DT')!=-1? obj.dt=otdt.split('(')[0] : obj.ot=otdt.split('(')[0];
delete obj.dayStatus;
delete obj.hrsStatus;
obj.name = objs.name;
outputDays[parseInt(key)+1] = obj
}
}
output[i] = outputDays;
})
copy(output)
@nsdevaraj
Copy link
Author

nsdevaraj commented Apr 24, 2019

temp1 = temp1.concat(temp2)

outputDays['Apr-'+(parseInt(key)+1)] = obj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment