@mvc-works/edn2json

0.1.0 • Public • Published

edn2json

small scripts to convert between EDN string and JSON data. based on jsedn.

Notice: the core logics is not robust. Use jsedn if you have to keep stable. Checkout tests for details.

Usage

npm install @mvc-works/edn2json
let {edn2json, json2edn} = require('@mvc-works/edn2json')

json2edn({a: 1, "b?": 2}) // '{:a 1 :b? 2}'
edn2json('{:a 1 :b [2 :x]}') // {a: 1, b: [2, 'x']}

Conventions:

  • when converting to JSON, :keyword drops :s.
  • when converting to EDN, only keys match /^[a-z][a-z-]*[\?\!]?$/ turned into keywords.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @mvc-works/edn2json

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

3.71 kB

Total Files

5

Last publish

Collaborators

  • jiyinyiyong