Forum Discussion

JensDeveloper's avatar
JensDeveloper
Contributor II
2 years ago
Solved

Transform values of a key into an object with list of the value

Hi, So I am trying to change my json data in a way that we have a list of companies that show every record with the name of the company in an object with the required fields My input: { "compan...
  • alchemiz's avatar
    2 years ago

    Hi JensDeveloper ,

    Good day, hope this helps ðŸ˜Š

    $.map(c=> sl.ensureArray(c['companies']['CURRENT_COMPANY_DISPLAY_NAME']).toObject((x,y)=> x, (x,y)=> c.get('companies').filter((v,k)=> k != 'CURRENT_COMPANY_DISPLAY_NAME')))

     

    ~EmEm