Result format data overite

System Information
  • Strapi Version : v4
  • Operating System: Windows
  • Database: SqlLite
  • Node Version: v16.10.0
  • NPM Version: 7.24.0
  • Yarn Version: 1.22.15

Hello,

When we get data from strapi, i got data in my result.

image

Can we overite this ? (same, can we get all attributes under id, not in the attributes object ?)

Somebody ask for the same thing here :

Thx

BTW, thx for you’re job guys !

I solve it with a custom fucntion recursive in front :

private dataIsShit(object: any) {
    if(object === null) {
      return null;
    }
    if (object.data) {
      object = object.data;
    }
    if (Object.prototype.toString.call(object) === '[object Array]') {
      object.forEach((r: any) => {
        r = this.dataIsShit(r);
      });
    } else if (typeof object === 'object') {
      for (const property in object) {
        object[property] = this.dataIsShit(object[property]);
      }

    }
    return object;
  }