# TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module needs an import attribute of "type: json"

**Code:** `ERR_IMPORT_ATTRIBUTE_MISSING` · **Category:** Node.js · **Seen on:** Node.js

An ES module imported a .json file without the required import attribute.

## Meaning

Native ESM requires `with { type: 'json' }` (older Node: assert { type: 'json' }) when importing JSON.

## Common causes

- import data from './data.json' without attributes
- Older code using assert syntax on newer Node

## Quick fix

1. Use import data from './data.json' with { type: 'json' }
2. Or read with fs and JSON.parse
3. Or createRequire for CommonJS-style require

## Detailed fix by platform

### Node.js

1. `import config from './config.json' with { type: 'json' };`

## How to diagnose

1. **Import** — How is the JSON imported?
2. **Node** — Version?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nodejs/err-import-attribute-missing)
