---
title: "Importing vs fetching JSON"
url: https://daily.dev/posts/importing-vs-fetching-json-htnxekagb
source_url: https://jakearchibald.com/2025/importing-vs-fetching-json/
type: article
source: "Jake Archibald"
published: 2025-10-22T15:19:20.420Z
updated: 2025-10-22T15:19:42.350Z
tags: ["webdev", "javascript", "performance", "vite"]
reading_time: 3
upvotes: 37
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Importing vs fetching JSON

**[Jake Archibald](https://daily.dev/sources/jakearchibald)** · 3 min read · 37 upvotes · 0 comments

## Summary

JSON module imports are now baseline across browsers, but they have important behavioral differences from fetch(). Module imports cache data for the page lifetime and can cause memory leaks with dynamic data or large objects, while fetch() allows garbage collection. Error handling with fetch() also provides better introspection through response status and text fallbacks. JSON imports work best for local static resources that bundlers can optimize, but fetch() remains the better choice for API calls and dynamic data.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://jakearchibald.com/2025/importing-vs-fetching-json/>

## Similar posts on daily.dev

- [Native JSON modules are finally real](https://daily.dev/posts/native-json-modules-are-finally-real-zkdi3tmao) · Matt Smith · 23 upvotes · 2 comments
- [Fetch vs Axios: Which One Should You Use? A Complete Beginner’s Guide](https://daily.dev/posts/fetch-vs-axios-which-one-should-you-use-a-complete-beginner-s-guide-eafsnj48b) · Medium · 2 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#javascript](https://daily.dev/tags/javascript), [#performance](https://daily.dev/tags/performance), [#vite](https://daily.dev/tags/vite)

[View this post on daily.dev](https://daily.dev/posts/importing-vs-fetching-json-htnxekagb)
