# format-json-string

> format JSON string, download JSON string to file

Latest version **1.0.0** (published 2021-09-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install format-json-string
pnpm add format-json-string
yarn add format-json-string
bun add format-json-string
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-09-25 |
| First published | 2021-09-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rhys.zhao |
| Maintainers | rhys.zhao123 |
| Keywords | formatJson, formatToJson, format, json, download, json-download, format-to-json |

## Links

- npm: https://www.npmjs.com/package/format-json-string
- npm.io page: https://npm.io/package/format-json-string

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-09-25

## README

## 描述
format-json-string用于浏览器，提供格式化json字符串和下载json文件功能
## 安装
```
npm install format-json-string --save
``` 
## 使用
format-json-string有2个方法，可根据需要引入
```
import { formatJson, downloadJsonFile } from 'format-json-string';
```
## 方法介绍
```formatJson(jsonString, indentNum = 2)```: 返回格式化后的json字符串。jsonString为需要格式化的json字符串。indentNum为缩进的空格数，默认为2个空格。<br>
```downloadJsonFile(jsonString, filename = 'download.json')```: 将传入的json字符串下载到文件中去。jsonString为需要下载的json字符串。filename为下载的文件名，默认为'download.json'

---
_Source: https://npm.io/package/format-json-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
