# standard-json

> Format JavaScript Standard Style output to a JSON array.

Latest version **1.1.0** (published 2019-08-13) · ISC license · 0 weekly downloads

## Install

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

Provides the command `standard-json`.

## 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.1.0 |
| Published | 2019-08-13 |
| First published | 2015-08-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Dan Flettre |
| Maintainers | feross, flet, gtanner |
| Keywords | format, json, output, standard, style |

## Links

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

## Dependencies (1)

- [concat-stream](https://npm.io/package/concat-stream.md) ^2.0.0

## 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.1.0 (latest) — 2019-08-13
- 1.0.3 — 2018-05-17
- 1.0.2 — 2016-12-27
- 1.0.1 — 2016-02-26
- 1.0.0 — 2015-08-04

## README

# standard-json

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![downloads][downloads-image]][downloads-url]
 
[npm-image]: https://img.shields.io/npm/v/standard-json.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/standard-json
[travis-image]: https://img.shields.io/travis/standard/standard-json.svg?style=flat-square
[travis-url]: https://travis-ci.org/standard/standard-json
[downloads-image]: https://img.shields.io/npm/dm/standard-json.svg?style=flat
[downloads-url]: https://npmjs.org/package/standard-json

Format JavaScript Standard Style output to a JSON array!

## Install

```
# use the CLI
npm install --global standard-json

# or use programatically
npm install --save standard-json
```

## CLI Usage

```bash
standard | standard-json
# exit code will be 1 if any errors are found

standard --verbose | standard-json
# the ruleId attribute will be filled in if --verbose is passed

# works with anything based on standard-engine!
semistandard | standard-json
doublestandard | standard-json

```

## Example output JSON (formatted)
Typical `standard` output:
```bash
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
  /home/icmpdev/code/standard-json/bin.js:19:21: Missing space before function parentheses.
  /home/icmpdev/code/standard-json/index.js:6:35: Strings must use singlequote.
  /home/icmpdev/code/standard-json/index.js:6:51: Extra semicolon.
  /home/icmpdev/code/standard-json/index.js:17:5: Keyword "if" must be followed by whitespace.
  /home/icmpdev/code/standard-json/index.js:22:28: Extra semicolon.
```

After running through standard-json:
```json
[
  {
    "filePath": "/home/flet/code/something-great/bin.js",
    "messages": [
      {
        "line": "19",
        "column": "21",
        "message": "Missing space before function parentheses."
      }
    ]
  },
  {
    "filePath": "/home/flet/code/something-great/index.js",
    "messages": [
      {
        "line": "6",
        "column": "35",
        "message": "Strings must use singlequote."
      },
      {
        "line": "6",
        "column": "51",
        "message": "Extra semicolon."
      },
      {
        "line": "17",
        "column": "5",
        "message": "Keyword \"if\" must be followed by whitespace."
      },
      {
        "line": "22",
        "column": "28",
        "message": "Extra semicolon."
      }
    ]
  }
]
```

## API Usage

```js

var txt = someStandardThing() // produces Standard Style output

var standardJson = require('standard-json')

var output = standardJson(txt)
// output will be an array of errors or an empty array.

var output = standardJson(txt, {noisey: true})
// output will be an array of errors or an empty array.
// The banner will be `console.error`'d (plus any other non-parsable lines)

```

## Inspiration

This package was inspired by:
- [snazzy](https://github.com/standard/snazzy)
- https://github.com/standard/standard/issues/222


## Contributing

Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.

## License

[ISC](LICENSE.md)

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