Strapi: API response with FK relations

System Information
  • Strapi Version: 3
  • Operating System:
  • Database: PostgreSQL
  • Node Version: 14
  • NPM Version:
  • Yarn Version:

Hi,

I am sending an object (e.g. user) in response to a GET API, This user object/table contains references of other tables e.g. company. so my response will be something like this

{
  id: 1,
  name: 'user name',
  company: {
    id: 1,
    name: 'company name'
  }
}

My requirement is, if i need only company id then in response i should have Id as suffix with the relational object name, So response should be

{
  id: 1,
  name: 'user name',
  companyId: 1
}

Instead of

{
  id: 1,
  name: 'user name',
  company: 1
}

Is there any way in Strapi framework to handle this requirement? I want to avoid any custom logic to do such stuff. Any quick help will be much appreciated.