# edn2json

> Convert EDN format to JSON format.

Latest version **0.1.6** (published 2016-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install edn2json
pnpm add edn2json
yarn add edn2json
bun add edn2json
```

Provides the command `edn2json`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2016-09-22 |
| First published | 2016-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Junhao Li |
| Maintainers | streaver91 |

## Links

- npm: https://www.npmjs.com/package/edn2json
- Repository: https://github.com/jl2922/edn2json
- Homepage: https://github.com/jl2922/edn2json#readme
- Issues: https://github.com/jl2922/edn2json/issues
- npm.io page: https://npm.io/package/edn2json

## Dependencies (2)

- [pegjs](https://npm.io/package/pegjs.md) ^0.10.0
- [command-line-args](https://npm.io/package/command-line-args.md) ^3.0.1

## Recent versions

- 0.1.6 (latest) — 2016-09-22
- 0.1.5 — 2016-09-20
- 0.1.4 — 2016-09-20
- 0.1.3 — 2016-09-20
- 0.1.2 — 2016-09-20
- 0.1.1 — 2016-09-20
- 0.1.0 — 2016-09-19

## README

# edn2json
Convert EDN format to JSON format.

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

## Installation

```bash
sudo npm install -g edn2json # CLI.
npm install edn2json # NodeJS.
```

## Usage

### To use as CLI
```bash
edn2json [path-to-edn-input]
```
By default, it will output JSON with the same filename as the EDN file but with '.json' extension, which can be customized by:
```bash
edn2json [path-to-edn-input] -o [path-to-json-output]
```

### To use in NodeJS
```javascript
const parser = require('edn2json');

var ednString = '[{"foo" "bar"}]';
var data = parser.parse(ednString);
var jsonString = JSON.stringify(data); // [{"foo":"bar"}].
```

### To use in browser

First install pegjs compiler and compile `convert.pegjs`:
```bash
sudo npm install -g pegjs
pegjs --format globals --export-var [variable-name] -o [path-to-js-output] convert.pegjs
```
Then in the HTML:
```html
<!-- Suppose the js output is edn-parser.js and variable name is ednParser. -->
<script src="edn-parser.js"></script>

<script>
var ednString = '[{"foo" "bar"}]';
var data = ednParser.parse(ednString);
var jsonString = JSON.stringify(data); // [{"foo":"bar"}].
</script>
```

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