0

I have an object array like this where the value in the ccy field is not unique:

data = [{'id': 0, 'ccy': 'USD'}, ...]

from which I want to obtain an object array like this:

[{'ccy': 'USD'}, ...] 

where the ccy values are all unique and sorted.

I have been mucking around and obtained a sorted unique array of ccy values

output = [...new Set(data.map(s => s.ccy))].sort();

but not sure how to convert that back to an array of objects

Anand
  • 1,387
  • 2
  • 26
  • 48

0 Answers0