将具有相同字段名称的对象数组分组并从相似对象创建值数组

时间:2020-05-11 09:56:45

标签: javascript arrays object

我有如下对象数组:

???

我想要这样的输出:

[
    { "field": "state", "operator": "EQUALS", "value": "NY" },
    { "field": "deceased", "operator": "EQUALS", "value": false },
    { "field": "county", "operator": "EQUALS", "value": "Albany" },
    { "field": "county", "operator": "EQUALS", "value": "Orange" },
    { "field": "address_line_1", "operator": "IS NOT EMPTY", "value": "is not null" },
    { "field": "city", "operator": "IS NOT EMPTY", "value": "is not null" },
    { "field": "zip_code", "operator": "IS NOT EMPTY", "value": "is not null" },
    { "field": "opt_out_do_not_mail", "operator": "EQUALS", "value": false },
    { "field": "recipient_reliability_code", "operator": "EQUALS", "value": "High" },
    { "field": "gender_code", "operator": "EQUALS", "value": "Male" },
    { "field": "gender_code", "operator": "EQUALS", "value": "Female" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 126" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 608" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 365" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 612" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 389" },
    { "field": "encounter_facility", "operator": "EQUALS", "value": "BS&W Facility 101" }
]

0 个答案:

没有答案