Fetch wrapper for json resorces


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
Minified + gzip package size for @booli/fetch-json in KB


Fetch Json

Wrapper around fetch to request json and geo json resources, including some general error handling.

Note that 204 responses will return an empty object {} instead of a body with no content, so subsequent json parsing does not fail.

Required polyfills

  • fetch
  • Object.assign
  • Promise (indirectly needed as fetch polyfills require it)


Most fetch requests expect json response and setting up request headers,checking response headers and handling http errors involve some boilerplate, which is abstracted away by this package. Note that unlike native fetch this wrapper will reject the returned promise if the response has an error status code.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.