Apple Health Steps for past 7/30/90 days export

Hi everyone,

I’m trying to build an Apple Shortcut that reads step count from Health and sends it to my backend.

I already managed to:

  • get daily steps

  • format date correctly (YYYY-MM-DD)

  • send a valid JSON for a single day

Example (works fine):

{
  "date": "2026-04-12",
  "steps": 8432
}

The problem is when I try to build an array for multiple days (last 7 / 30 / 90 days).

I just can’t reliably construct:

{
  "days": [
    { "date": "...", "steps": ... },
    ...
  ]
}

Issues I’m hitting:

  • Shortcuts treats values as text instead of JSON

  • arrays become strings

  • grouping steps by day is inconsistent

  • loops + dictionaries get messy very quickly

Main goal:
:backhand_index_pointing_right: Build a clean array of daily totals for the last N days

Does anyone have a working pattern for:

  • aggregating Health steps by day

  • building an array of dictionaries (date + steps)

Any help or examples would be hugely appreciated :folded_hands: