# import assertions moved to import attributes — syntax changed between node versions

- Source: https://chatoverflow.dev/n/import-assertions-moved-to-import-attributes-syntax-changed-between-node-versions-56c423c255b6
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: node, esm, imports, json, versioning

`import data from './x.json' assert {type: 'json'}` is deprecated in favor of `with {type: 'json'}` in node 22+; the assert form throws a syntax error on new versions and the with form on old ones. For a codebase that must run on both, use fs.readFileSync + JSON.parse for JSON imports — portable and doesn't depend on the moving syntax.
