By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: JSON Modules Can Now Be Imported in JavaScript in All Modern Browsers, CSS Modules to Follow
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > News > JSON Modules Can Now Be Imported in JavaScript in All Modern Browsers, CSS Modules to Follow
News

JSON Modules Can Now Be Imported in JavaScript in All Modern Browsers, CSS Modules to Follow

News Room
Last updated: 2025/06/25 at 11:12 PM
News Room Published 25 June 2025
Share
SHARE

Thomas Steiner, Developer Relations Engineer at Google, recently published a blog post announcing that JSON module scripts were now available in all modern browsers. Developers using the latest version of modern browsers can now directly import JSON modules into their JavaScript code. The feature builds on the Import Attributes proposal. Native CSS modules import may soon follow.

Import attributes tell the runtime how a particular module should be loaded. The primary use case is to load non-JS modules, such as JSON modules and CSS modules.

Steiner provides the following code sample to illustrate the syntax:

import astronomyPictureOfTheDay from "./apod.json" with { type: "json" };

const {explanation, title, url} = astronomyPictureOfTheDay;

document.querySelector('h2').textContent = title;
document.querySelector('figcaption').textContent = explanation;
Object.assign(document.querySelector('img'), { src: url, alt: title });

Non-browser runtimes such as Deno align with browser semantics:

import file from "./version.json" with { type: "json" };
console.log(file.version);
const module = await import("./version.json", {
  with: { type: "json" },
});
console.log(module.default.version);
{
  "version": "1.0.0"
}

In both cases, there is no JSON parsing needed as all major browsers implemented the native parsing as part of Interop 2025 (Baseline Newly available). Previously, web developers’ options included using a bundler, an extra transpilation step, or using polyfills to support those browsers that had not implemented the feature yet.

On the web, each import statement results in an HTTP request. The response is then prepared into a JavaScript value and made available to the program by the runtime. The specification explicitly calls out type: "json" to be supported. The type attribute however also supports CSS modules:

import styles from "https://example.com/styles.css" with { type: "css" };

As a developer noted on Reddit, CSS module imports are not part of Interop 2025 but may be included in the next Interop:

I proposed it for Interop 2025 but it was rejected, so hopefully next year. Though it is currently supported in Chrome.

With CSS, the result of importing a CSS file would be a constructable stylesheet, something that you could feed directly to a DOM API like adoptedStyleSheets (e.g. custom elements / Web Components)

[…] Just gotta wait for the CFP for Interop 2026

While this was considered in earlier versions of the proposal, JSON modules do not however support named exports. The proposal champions opted not to allow named exports because not all JSON documents are objects, and in their opinion, it made more sense to think of a JSON document as conceptually “a single thing” rather than several things that happen to be side-by-side in a file.

Developers can review the browser compatibility of the Import Attributes syntax, CSS module imports, and JSON module imports on MDN.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Just released Android 16 QPR beta update causes Pixels to crash unless you have this feature disabled
Next Article NetEase shuts down Ouka Studios, developer of Visions of Mana · TechNode
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Google rolls out latest Android 16 beta update for pixel with bug fixes
Software
PSA: Fortnite for iPhone and iPad no longer runs on iOS 26 beta after Blitz Royale update [U] – 9to5Mac
News
How to Build a Community on Social Media
Computing
Cambridge Enterprise opens first-ever London office – UKTN
News

You Might also Like

News

PSA: Fortnite for iPhone and iPad no longer runs on iOS 26 beta after Blitz Royale update [U] – 9to5Mac

3 Min Read
News

Cambridge Enterprise opens first-ever London office – UKTN

2 Min Read
News

Chrome, Edge, Firefox, Opera, or Safari: Which Browser Is Best for 2025?

22 Min Read
News

Get 1TB of lifetime cloud storage for £88 with this iCloud alternative

2 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?