I have an existing array that I would like to reformat in JS. Here is the existing array where each item is an object:
[
 {
  end_time:"7.14",
  pk:45065,
  start_time:"4.51",
  text:"Lorem Ipsum"
 },
 {
  end_time:"9.00",
  pk:45066,
  start_time:"7.14",
  text:"Lorem Ipsum Something"
 },
 {
  end_time:"13.09",
  pk:450667 ,     
  start_time:"9.00",
  text:"Lorem Ipsum Something"
 }, 
 {
  end_time:"17.01",
  pk:45068,
  start_time:"13.09",
  text:"Lorem Ipsum"
 },
 {
  end_time:"25.10",
  pk:45069,
  start_time:"17.01",
  text:"Lorem Ipsum Something"
 },
 {
  end_time:"28.06",
  pk:450670 ,     
  start_time:"25.10",
  text:"Lorem Ipsum Something"
 },
]
I would like to create a new array of objects where for every three objects in old array becomes one object in the new array like so:
 [
  segment: {
    phrase: {
      end_time:"7.14",
      pk:45065,
      start_time:"4.51",
      text:"Lorem Ipsum"
    },
    phrase: {
      end_time:"9.00",
      pk:45066,
      start_time:"7.14",
      text:"Lorem Ipsum Something"
     },
     phrase: {
      end_time:"13.09",
      pk:450667 ,     
      start_time:"9.00",
      text:"Lorem Ipsum Something"
     }
  },
  segment {
    phrase: {
      end_time:"17.01",
      pk:45068,
      start_time:"13.09",
      text:"Lorem Ipsum"
    },
    phrase: {
      end_time:"25.10",
      pk:45069,
      start_time:"17.01",
      text:"Lorem Ipsum Something"
    },
    phrase: {
      end_time:"28.06",
      pk:450670 ,     
      start_time:"25.10",
      text:"Lorem Ipsum Something"
    },
  }
]
What I am struggling with most is how to pull out every three items and push to the new segment object inside a map or loop I guess. I am not sure the most efficient way to go about this. Any help is much appreciated.
 
     
    