# json-format

> JSON format for good presentation

Latest version **1.0.1** (published 2017-04-06) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2017-04-06 |
| First published | 2014-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Author | luizstacio |
| Maintainers | luizstacio |
| Keywords | json, format, json, pretty, json, write, identation, json, ident, format |

## Links

- npm: https://www.npmjs.com/package/json-format
- Repository: https://github.com/luizstacio/json-format
- Issues: https://github.com/luizstacio/json-format/issues
- npm.io page: https://npm.io/package/json-format

## 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.1 (latest) — 2017-04-06
- 1.0.0 — 2016-12-25
- 0.1.2 — 2016-02-12
- 0.1.1 — 2015-09-28
- 0.0.1 — 2014-07-14

## README

json-format
==========

[![Build Status](https://travis-ci.org/luizstacio/json-format.svg?branch=master)](https://travis-ci.org/luizstacio/json-format.svg?branch=master)

Parse JavaScript Object to a JSON String indented.

#### Instaling
```
  npm install json-format
```

#### Usage
```
  var jsonFormat = require('./');
  var fs = require('fs');
  var obj = {
    a: 1,
    b: 2
  }

  /* using config default, indent with tabs */
  fs.writeFile('example_tabs.json', jsonFormat(obj), function(err){
    if (err) throw err;
    console.log('saved');
  });

  /* using indent with spaces */
  var config = {
    type: 'space',
    size: 2
  }

  fs.writeFile('example_spaces.json', jsonFormat(obj, config), function(err){
    if (err) throw err;
    console.log('saved');
  });
```

##### Result `example_tabs.json`
```
{
    "a": 1,
    "b": 2
}
```

##### Result `example_spaces.json`
```
{
  "a": 1,
  "b": 2
}
```

#### Default sizes
```
{
  tab: { size: 1 },
  space: { size: 4 }
}
```

#### Config default
```
{
  type: 'tab'
}
```

[Based in this project](https://github.com/phoboslab/json-format).

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