Populate foreign key data in API workflow return value

I am trying to build an API Workflow that returns JSON with data populated from foreign keys, instead of the foreign keys themselves. For example, I need this

  {
    "class": "Bubble 101",
      "teacher": {"firstName": "John", "lastName": "Smith"},
      "students": [
        {"firstName": "Bob", "lastName": "Jones"},
        {"firstName": "Joan", "lastName": "Tyler"}
      ]
  }

Whereas I have only managed to return this:

{
  "class": "Bubble 101",
  "teacher": "1659379552356x854367708571290100",
  "students": [
    "1659349552856x854367708571290200",
    "1659349552856x854367708571290300",
  ]
}

Is this possible with bubble? It seems like such a basic requirement.