You could use reduce to group them in to an accumulator object with "0-1s" and "1-2s" as keys. Then use Object.values()Object.values() to get the array of values:
const input = [{ "0-1s": 6, "1-2s": 2, country: "us" }, { "0-1s": 1, "1-2s": 4, country: "ja" }, { "0-1s": 3, "1-2s": 9, country: "ca" }] const grouped = input.reduce((r, o) => { r["0-1s"] = r["0-1s"] || { time: "0-1s" }; r["1-2s"] = r["1-2s"] || { time: "1-2s" }; r["0-1s"][o.country] = o["0-1s"] r["1-2s"][o.country] = o["1-2s"] return r; }, {}) console.log(Object.values(grouped))
const input = [{ "0-1s": 6, "1-2s": 2, country: "us" }, { "0-1s": 1, "1-2s": 4, country: "ja" }, { "0-1s": 3, "1-2s": 9, country: "ca" }] const grouped = input.reduce((r, o) => { r["0-1s"] = r["0-1s"] || { time: "0-1s" }; r["1-2s"] = r["1-2s"] || { time: "1-2s" }; r["0-1s"][o.country] = o["0-1s"] r["1-2s"][o.country] = o["1-2s"] return r; }, {}) console.log(Object.values(grouped))
If each object has more dynamic time ranges like 0-1s etc, you could destrcuture the object in the reduce parameter to get the country and looprest of the time ranges to separate properties. Loop through the entries of rest to update value for each objecttime range: