https://github.com/porada/prettier-plugin-expand-json
Prettier plugin that expands JSON arrays and objects into multi-line notation
https://github.com/porada/prettier-plugin-expand-json
npm-package prettier prettier-plugin
Last synced: 3 months ago
JSON representation
Prettier plugin that expands JSON arrays and objects into multi-line notation
- Host: GitHub
- URL: https://github.com/porada/prettier-plugin-expand-json
- Owner: porada
- License: mit
- Created: 2026-01-20T19:57:47.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-01-21T22:08:36.000Z (3 months ago)
- Last Synced: 2026-01-22T06:36:59.724Z (3 months ago)
- Topics: npm-package, prettier, prettier-plugin
- Language: TypeScript
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/prettier-plugin-expand-json)
[](https://github.com/porada/prettier-plugin-expand-json/actions/workflows/test.yaml)
[](https://codecov.io/github/porada/prettier-plugin-expand-json)
# prettier-plugin-expand-json
Expand JSON arrays and objects into multi-line notation with Prettier—for JSON and JSONC files.
## Example
```json
{
"extends": "@standard-config/tsconfig",
"compilerOptions": { "exactOptionalPropertyTypes": true },
"files": ["src/index.ts", "src/index.d.ts"]
}
```
…will always be formatted as:
```json
{
"extends": "@standard-config/tsconfig",
"compilerOptions": {
"exactOptionalPropertyTypes": true
},
"files": [
"src/index.ts",
"src/index.d.ts"
]
}
```
## Install
```sh
npm install --save-dev prettier-plugin-expand-json
```
```sh
pnpm add --save-dev prettier-plugin-expand-json
```
## Usage
Reference `prettier-plugin-expand-json` in your [Prettier config](https://prettier.io/docs/configuration):
```json
{
"plugins": [
"prettier-plugin-expand-json"
]
}
```
If you’re using multiple JSON-related plugins, make sure `prettier-plugin-expand-json` is listed last. This applies to each `overrides` entry as well.
```json
{
"plugins": [
"prettier-plugin-sort-json",
"prettier-plugin-expand-json"
]
}
```
```json
{
"plugins": [
"prettier-plugin-expand-json"
],
"overrides": [
{
"files": "packages/**/package.json",
"options": {
"plugins": [
"prettier-plugin-pkg",
"prettier-plugin-expand-json"
]
}
}
]
}
```
## Related
- [**@standard-config/prettier**](https://github.com/standard-config/prettier)
## License
MIT © [Dom Porada](https://dom.engineering)