Get JSON from URL, return array and count instances

I’m trying to map the JSON from the URL to an array but I think my mapping of the data isn’t correct. I want to find every value inside of attributes and count how many instances of each value there are in the JSON file/ array.

[
  {
    name: "1",
    attributes: [
      {
        trait_type: "hat",
        value: "blue"
      },
      {
        trait_type: "hair",
        value: "red"
      }
    ]
  } 
];

$.getJSON(
  "https://jsonware.com/api/v1/json/3c53cbcd-5351-4fba-8b89-5f1fb009e857",
  function (data) {
    var items = $.map(data.attributes, function (i) {
      return i.value;
      const result = data.reduce(
        (acc, curr) => ((acc[curr] = (acc[curr] || 0) + 1), acc),
        {}
      );
      console.log(result);
      console.log(items);
    });
  }
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>