Detailed HTTP error

Hey how can I get the json version of an HTTP Error because sometimes the api I use said more detailed about the error in the json
I want to get an error like this:

{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "The requested resource could not be found."
  }
}

sorry for my bad English this is not my native language

You should be able to reference "type" and "message" when you decode the JSON.

local data = HttpService:JSONDecode(request)
print(data["error"]["type"]) -- Outputs error.type, which is "not_found_error"

Nvm, I used HttpService:PostAsync before, and when there was an error, it returned a string. Instead, I used HttpService:RequestAsync, and it returned what I needed. Thank you for your answers.