I'm using external API to make an SQL query for a user. As a result i get matching Entity but as a set of fields, lookin like this:

```
[
  { IsNull: false, Name: 'Key', Value: '897', Values: null },
  { IsNull: false, Name: 'FirstName', Value: 'User', Values: null },
  { IsNull: false, Name: 'LastName', Value: 'Portal', Values: null },
  {
    IsNull: false,
    Name: 'Email',
    Value: 'some@email.com',
    Values: null
  },
  { IsNull: true, Name: 'Salutation', Value: null, Values: null },
  { IsNull: false, Name: 'Type', Value: '2', Values: null },
  {
    IsNull: false,
    Name: 'LastLoggedDate',
    Value: '2022-12-01 15:24:03',
    Values: null
  }
]

```

How to transform this response to end with simple object { email: 'some@email', firstName: 'User' lastName: 'Portal' } ??

I ended up with solution like this (below) but i believe there's some easiest way to do that, especially with more fields

```
let userRawEntity = queryResult.data.Entities[0].Fields;
const userEmail = userRawEntity.filter((obj) => { return obj.Name === 'Email' });
const userFirstName = userRawEntity.filter((obj) => { return obj.Name === 'FirstName' });
const userLastName = userRawEntity.filter((obj) => { return obj.Name === 'LastName' });

return { email: userEmail[0].Value, firstName: userFirstName[0].Value, lastName: userLastName[0].Value };

```

Edit:
final solution that works and looks nicer. thanks for help :)

```
      if (queryResult.data.TotalEntityCount > 0) {
        let user: {[key: string]: string | null } = {}
        let userRawEntity = queryResult.data.Entities[0].Fields;

        userRawEntity.forEach(data => user[data.Name] = data.Value);

        return { email: user.Email, currency: user.Currency } as JwtPayload;
      }

```