Reminders: Enter nested objects

Hi everyone,

I try to write a simple script but I am very new in Javascript.

I want to do move every reminder which is

  • is incomplete
  • due date is longer than 2 days ago
  • the calendar is my “Habits” calendar.
    to the calendar “Habits_Incomplete”

I started like that:

let reminders = await Reminder.scheduled() 

//let calendars = await Calendar
//cstr = JSON.stringify(calendars);
//cstr = JSON.stringify(calendars, null, 4); // (Optional) beautiful indented output.
//console.log(cstr); // Logs output to dev tools console.

str = JSON.stringify(reminders);
str = JSON.stringify(reminders, null, 4); // (Optional) beautiful indented output.
console.log(str); // Logs output to dev tools console.

for (reminder of reminders) {
  var btime = new Date(reminder.dueDate);
  var delta_time = (btime - atime)/ (1000 * 3600 * 24);

          // Find the calendar list to move the reminder to
          let cal = await Calendar.findOrCreateForReminders("Habits_Incomplete")
          //reminder.calendar = cal

But how do I bring the nested dictionary of the reminders which includes the calendar: title in my

        "identifier": "55D73F64-8A71-4261-A9AF-4B87DF3E1116",
        "title": "Flohsamenschalen",
        "isCompleted": false,
        "isOverdue": false,
        "priority": 5,
        "dueDate": "2022-02-16T07:00:00.000Z",
        "dueDateIncludesTime": true,
        "completionDate": null,
        "creationDate": "2022-02-13T15:45:17.000Z",
        "calendar": {
            "identifier": "7C5F7A7F-1D2F-4A36-BD99-19E0359D561D",
            "title": "Habits",
            "isSubscribed": false,
            "allowsContentModifications": true,
            "color": {
                "hex": "FF2968",
                "red": 1,
                "green": 0.1607843041419983,
                "blue": 0.40784314274787903,
                "alpha": 1