0.1.0 • Published 4 years ago

@mvc-works/edn2json v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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