A lightweight wrapper around the WHATWG fetch() API that automatically parses JSON responses and resolves only for successful HTTP status codes (200-299) with valid JSON. Version 1.0.1 is the latest and only stable version. It has zero runtime dependencies but expects a fetch polyfill in environments without native fetch. Unlike raw fetch, it simplifies JSON handling by providing a resolved `.json` property on success and an `.error` property on rejection. Suitable for projects where you want concise JSON fetching without manual response parsing.
npm install simple-json-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing the polyfill and jsonFetch, making a GET request, and handling success/failure with automatic JSON parsing.
npm install whatwg-fetch and add import 'whatwg-fetch' at the top of your entry file.
Always handle rejection, and check response.status for additional context.
Consider adding tests or use a well-tested alternative like ky or got.
Install whatwg-fetch (npm install whatwg-fetch) and add import 'whatwg-fetch' before using simple-json-fetch.
Use import jsonFetch from 'simple-json-fetch' (without curly braces).
Change to import jsonFetch from 'simple-json-fetch' or use dynamic import().
No dependency data recorded yet.