In the following API response, I have an object of time_entries, each having an ID as a key.
{"count":5,"results":[{"key":"time_entries","id":"1522040735"},{"key":"time_entries","id":"1522040395"},{"key":"time_entries","id":"1517855265"},{"key":"time_entries","id":"1517854385"},{"key":"time_entries","id":"1517853315"}],"time_entries":{"1522040735":{"created_at":"2020-06-22T13:54:54-07:00","updated_at":"2020-06-22T13:54:54-07:00","date_performed":"2020-06-22","time_in_minutes":75,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297425","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040735"},"1522040395":{"created_at":"2020-06-22T13:54:42-07:00","updated_at":"2020-06-22T13:54:42-07:00","date_performed":"2020-06-22","time_in_minutes":90,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297345","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040395"},"1517855265":{"created_at":"2020-06-19T10:32:50-07:00","updated_at":"2020-06-19T10:32:50-07:00","date_performed":"2020-06-19","time_in_minutes":60,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676695","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517855265"},"1517854385":{"created_at":"2020-06-19T10:32:12-07:00","updated_at":"2020-06-19T10:32:12-07:00","date_performed":"2020-06-19","time_in_minutes":120,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676755","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517854385"},"1517853315":{"created_at":"2020-06-19T10:31:40-07:00","updated_at":"2020-06-19T10:31:40-07:00","date_performed":"2020-06-19","time_in_minutes":180,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676765","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517853315"}},"meta":{"count":5,"page_count":1,"page_number":1,"page_size":20},"stories":{"569297425":{"title":"task5","description":"task5desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:54:08-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99960000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":75,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":31250,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":31250,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297425"},"569297345":{"title":"task4","description":"task4desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:53:55-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99970000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":90,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":37500,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":37500,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297345"},"568676695":{"title":"task1","description":"desc1","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:09-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":100000000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":60,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":10000,"budget_used_in_cents":30000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":30000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676695"},"568676755":{"title":"task2","description":"desc2","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:27-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99990000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":120,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":20000,"budget_used_in_cents":50000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":50000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676755"},"568676765":{"title":"task3","description":"desc3","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:36-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99980000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":180,"logged_billable_time_in_minutes":180,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":30000,"budget_used_in_cents":75000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":75000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676765"}}}
Problem is, for every API call, I won't know what that time entry ID is. It will change every time.
What I want to do is to capture a string output of a specific key inside each of those time entry objects.
For example, for time_in_minutes, what I need to capture in this case is: "75, 90, 60, 120, 180"
And I also need it to be in that format, regardless of how many entries there are—whether there are five entries or twenty.
Any tips or advice would be GREATLY appreciated.
I'm not sure if this is the most elegant or performant solution, but I think this produces the correct values:
//copied from the question
const apiResponse = {"count":5,"results":[{"key":"time_entries","id":"1522040735"},{"key":"time_entries","id":"1522040395"},{"key":"time_entries","id":"1517855265"},{"key":"time_entries","id":"1517854385"},{"key":"time_entries","id":"1517853315"}],"time_entries":{"1522040735":{"created_at":"2020-06-22T13:54:54-07:00","updated_at":"2020-06-22T13:54:54-07:00","date_performed":"2020-06-22","time_in_minutes":75,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297425","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040735"},"1522040395":{"created_at":"2020-06-22T13:54:42-07:00","updated_at":"2020-06-22T13:54:42-07:00","date_performed":"2020-06-22","time_in_minutes":90,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297345","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040395"},"1517855265":{"created_at":"2020-06-19T10:32:50-07:00","updated_at":"2020-06-19T10:32:50-07:00","date_performed":"2020-06-19","time_in_minutes":60,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676695","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517855265"},"1517854385":{"created_at":"2020-06-19T10:32:12-07:00","updated_at":"2020-06-19T10:32:12-07:00","date_performed":"2020-06-19","time_in_minutes":120,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676755","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517854385"},"1517853315":{"created_at":"2020-06-19T10:31:40-07:00","updated_at":"2020-06-19T10:31:40-07:00","date_performed":"2020-06-19","time_in_minutes":180,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676765","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517853315"}},"meta":{"count":5,"page_count":1,"page_number":1,"page_size":20},"stories":{"569297425":{"title":"task5","description":"task5desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:54:08-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99960000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":75,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":31250,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":31250,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297425"},"569297345":{"title":"task4","description":"task4desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:53:55-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99970000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":90,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":37500,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":37500,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297345"},"568676695":{"title":"task1","description":"desc1","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:09-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":100000000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":60,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":10000,"budget_used_in_cents":30000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":30000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676695"},"568676755":{"title":"task2","description":"desc2","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:27-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99990000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":120,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":20000,"budget_used_in_cents":50000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":50000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676755"},"568676765":{"title":"task3","description":"desc3","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:36-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99980000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":180,"logged_billable_time_in_minutes":180,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":30000,"budget_used_in_cents":75000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":75000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676765"}}}
const timeEntries = apiResponse['time_entries'];
const minuteTimes = Object.values(timeEntries).map(entry => entry['time_in_minutes']);
//prints [180, 120, 60, 90, 75]
console.log(minuteTimes);
If you need to filter the time_entries by id (if you want to look at a subset, for instance) then you can probably incorporate this
Let's define response to hold the API return, and what is the
property you wish to extract from each time_entries object.
function extract(response, what){
const parsed = (typeof(response)==='object')? response: JSON.parse(response);
return (Object
.keys(parsed.time_entries) // finds the keys
.sort((a,b)=>(+b-a)) // sorts the keys in reverse order
.map((k)=>(parsed.time_entries[k][what])) // finds the data
.filter((v)=>(v!==undefined)) // removes undefined data
.join(",") // changes to CSV [75,90,60,...] -> '75,90,60,...'
);
}
Testing in node.js
extract(response, 'time_in_minutes');
'75,90,60,120,180'
Try,
Object.keys() method on the object.
you can use Object.values to get the values of each key and do the map iteration for the specific result.
var resp = {"count":5,"results":[{"key":"time_entries","id":"1522040735"},{"key":"time_entries","id":"1522040395"},{"key":"time_entries","id":"1517855265"},{"key":"time_entries","id":"1517854385"},{"key":"time_entries","id":"1517853315"}],"time_entries":{"1522040735":{"created_at":"2020-06-22T13:54:54-07:00","updated_at":"2020-06-22T13:54:54-07:00","date_performed":"2020-06-22","time_in_minutes":75,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297425","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040735"},"1522040395":{"created_at":"2020-06-22T13:54:42-07:00","updated_at":"2020-06-22T13:54:42-07:00","date_performed":"2020-06-22","time_in_minutes":90,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"569297345","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1522040395"},"1517855265":{"created_at":"2020-06-19T10:32:50-07:00","updated_at":"2020-06-19T10:32:50-07:00","date_performed":"2020-06-19","time_in_minutes":60,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676695","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517855265"},"1517854385":{"created_at":"2020-06-19T10:32:12-07:00","updated_at":"2020-06-19T10:32:12-07:00","date_performed":"2020-06-19","time_in_minutes":120,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676755","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517854385"},"1517853315":{"created_at":"2020-06-19T10:31:40-07:00","updated_at":"2020-06-19T10:31:40-07:00","date_performed":"2020-06-19","time_in_minutes":180,"billable":true,"notes":"","rate_in_cents":25000,"cost_rate_in_cents":null,"currency":"USD","currency_symbol":"$","currency_base_unit":100,"user_can_edit":false,"approved":false,"taxable":false,"is_invoiced":true,"story_id":"568676765","workspace_id":"31689165","user_id":"13403745","active_submission_id":null,"recent_submission_id":null,"id":"1517853315"}},"meta":{"count":5,"page_count":1,"page_number":1,"page_size":20},"stories":{"569297425":{"title":"task5","description":"task5desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:54:08-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99960000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":75,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":31250,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":31250,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297425"},"569297345":{"title":"task4","description":"task4desc","updated_at":"2020-06-22T13:56:41-07:00","assignment_timestamped_at":"2020-06-22T13:56:41-07:00","created_at":"2020-06-22T13:53:55-07:00","due_date":null,"start_date":null,"story_type":"task","state":"started","position":99970000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":0,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":null,"logged_billable_time_in_minutes":90,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":null,"budget_used_in_cents":37500,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":37500,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"569297345"},"568676695":{"title":"task1","description":"desc1","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:09-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":100000000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":60,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":10000,"budget_used_in_cents":30000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":30000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676695"},"568676755":{"title":"task2","description":"desc2","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:27-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99990000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":120,"logged_billable_time_in_minutes":120,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":20000,"budget_used_in_cents":50000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":50000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676755"},"568676765":{"title":"task3","description":"desc3","updated_at":"2020-06-22T13:56:40-07:00","assignment_timestamped_at":"2020-06-22T13:56:40-07:00","created_at":"2020-06-19T10:26:36-07:00","due_date":null,"start_date":"2020-06-19","story_type":"task","state":"completed","position":99980000,"archived":false,"deleted_at":null,"sub_story_count":0,"percentage_complete":100,"priority":"normal","has_proofing_access":false,"ancestor_ids":[],"subtree_depth":0,"ancestry_depth":0,"time_trackable":true,"time_estimate_in_minutes":180,"logged_billable_time_in_minutes":180,"logged_nonbillable_time_in_minutes":0,"sub_stories_time_estimate_in_minutes":null,"sub_stories_billable_time_in_minutes":null,"weight":null,"budget_estimate_in_cents":30000,"budget_used_in_cents":75000,"uninvoiced_balance_in_cents":0,"invoiced_balance_in_cents":75000,"sub_stories_budget_estimate_in_cents":null,"sub_stories_budget_used_in_cents":null,"fixed_fee":false,"billable":true,"workspace_id":"31689165","creator_id":"13403745","parent_id":null,"root_id":null,"id":"568676765"}}}
var output = Object.values(resp.time_entries).map(val => val.time_in_minutes).join(',');
console.log(output);