I'm dealing with a huge dataSet using Angular5 service, so I want to call the backend API once and want to save the result into JSON.
I fetch the response and then store into several arrays according to my need,I'm looking how to add those arrays into JSON file.
getAllConcepts(){
let allOrderUUID="b3dac224-fdea-11e4-b248-005056820298";
this.allOrderableService.getAllOrderableConcepts(allOrderUUID).subscribe(allOrders=>{
let allOrderable=allOrders;
allOrderable.setMembers[0].setMembers.forEach(labSample=>{
this.labSamples.push(labSample);
});
allOrderable.setMembers[1].setMembers.forEach(radOrder=>{
this.radiologyOrder.push(radOrder);
});
this.separatePanelAndLabTestInlabSamples(this.labSamples);
this.separatePanelAndOrderInRadiologyLab(this.radiologyOrder);
});
}
separatePanelAndLabTestInlabSamples(labSample:any){
console.log("@receivedLabSample",labSample);
if(labSample.length>0)
{
labSample[0].setMembers.forEach(response=>{
if(response.conceptClass.uuid==="33a6291c-8a92-11e4-977f-0800271c1b75")
{
this.labSamplesTest.push(response);
}
if(response.conceptClass.uuid==="8d492026-c2cc-11de-8d13-0010c6dffd0f")
{
this.labSamplesPanel.push(response);
}
});
console.log("LabTest",this.labSamplesTest);
console.log("LabPanel",this.labSamplesPanel);
}
}
I'm able to receive the response,after getting the reponse I'm storing them into severals arrays,I'm confuse how I can add these array into JSON file for future use.The basic aim is to reduce the call to server.
I want to add following arrays that exist in code into JSON File.
I have all the arrays, I need to convert them into JSON file.