0.1.6 • Published 8 years ago

edn2json v0.1.6

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

edn2json

Convert EDN format to JSON format.

Build Status

Installation

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

Usage

To use as CLI

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:

edn2json [path-to-edn-input] -o [path-to-json-output]

To use in NodeJS

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:

sudo npm install -g pegjs
pegjs --format globals --export-var [variable-name] -o [path-to-js-output] convert.pegjs

Then in the 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>
0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago