Extracting NFT Attributes from OpenSea API using JavaScript

I’m building a web application and need to fetch NFT metadata from OpenSea’s API. Specifically, I want to extract the attributes/properties of tokens. I’ve been looking at their documentation but I’m not sure about the best approach to implement this in JavaScript.

Here’s an example of the attribute structure I’m trying to work with:

"attributes": [
  {
    "attribute_type": "clothing",
    "value": "blue jacket",
    "display_type": null,
    "max_value": null,
    "attribute_count": 0,
    "order": null
  },
  {
    "attribute_type": "environment",
    "value": "forest",
    "display_type": null,
    "max_value": null,
    "attribute_count": 0,
    "order": null
  },
  {
    "attribute_type": "character",
    "value": "warrior",
    "display_type": null,
    "max_value": null,
    "attribute_count": 0,
    "order": null
  },
  {
    "attribute_type": "facial_feature",
    "value": "beard",
    "display_type": null,
    "max_value": null,
    "attribute_count": 0,
    "order": null
  }
]

What’s the most effective way to retrieve and parse this data? Any code examples would be greatly appreciated.