node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

naml


  • Simple, unified API.
  • Freely convert between:

    • JSON (JavaScript Object Notation): .json
    • HJSON (Human JSON): .hjson
    • JSON5 (ES5 JSON): .json5
    • CSON (CoffeeScript Object Notation): .cson
    • YAML (Yet Another Markup Language): .yaml
    • TOML (Tom's Obvious, Minimal Language): .toml
    • INI (Initialization File Format): .ini

Installation

npm install naml

CLI

naml [input-file] [output-file]

Example: naml path/to/input.yaml path/to/output.json

API

const NAML = require('naml')

NAML.parse(string, type)

  • string {String}: the String to be parsed
  • type {String}: the input type; one of the following: json, hjson, json5, cson, yaml, toml, ini (may be prefixed with a .)
  • returns {Object}: the resulting Object
  • throws {Error}: if parsing failed

NAML.stringify(object, type)

  • object {Object}: the Object to be stringified
  • type {String}: the input type; one of the following: json, hjson, json5, cson, yaml, toml, ini (may be prefixed with a .)
  • returns {String}: the resulting String
  • throws {Error}: if stringifying failed

License

WTFPL – Do What the F*ck You Want to Public License.

Made with ❤️ by @MarkTiedemann.