JSON import attributesBaseline · Newly available
Module import … with { type: "json" } statements load JSON data. Also known as JSON module scripts.
Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Apr 29, 2025.
Browser support
DesktopChrome
1–122Not supported
123+Supportedsince Mar 19, 2024
Current: 155Edge
12–122Not supported
123+Supportedsince Mar 22, 2024
Current: 154Firefox
1–137Not supported
138+Supportedsince Apr 29, 2025
Current: 157Safari
1–17.1Not supported
17.2+Supportedsince Dec 11, 2023
Current: 27MobileChrome Android
18–122Not supported
123+Supportedsince Mar 19, 2024
Current: 155Firefox Android
4–137Not supported
138+Supportedsince Apr 29, 2025
Current: 157Safari iOS
1–17.1Not supported
17.2+Supportedsince Dec 11, 2023
Current: 27How to use
Every current browser supports this, but it only became Baseline on Apr 29, 2025. Use it as a progressive enhancement, or keep a fallback if you support older devices.
Example
Full syntax and examples are on MDN: with#json modules type json.
Feature detection
JS · check before using
// Syntax can't be tested with an if-statement — an unsupported
// browser fails to parse the whole script. Either transpile for older
// targets (e.g. Babel/TypeScript/esbuild), or probe in isolation:
let supported = true;
try {
new Function("/* code that uses the syntax */");
} catch {
supported = false;
}This is a language syntax feature.
Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| trailing_commas.trailing_commas_in_dynamic_import | 91 | 91 | 138 | 15 | 91 | 138 | 15 |
| import.import_attributes.type_json | 123 | 123 | 138 | 17.2 | 123 | 138 | 17.2 |