Wondering what’s next for npm?Check out our public roadmap! »

    json2toml

    2.1.0 • Public • Published

    json2toml

    Convert JSON to TOML.

    Example

    var json2toml = require('json2toml');
    
    json2toml({simple: true});
    // => 'simple = true\n'
    
    // Also supports pretty-printing options
    json2toml(
      {
        deeply: {
          option: false,
          nested: {
            option: true
          }
        }
      },
      { indent: 2, newlineAfterSection: true }
    );
    // => [deeply]
    // =>   option = false
    // =>
    // => [deeply.nested]
    // =>   option = true

    Installation

    $ npm install json2toml

    API

    var json2toml = require('json2toml');

    json2toml(hash, options = {})

    Converts an Object hash to TOML, and returns the result as a String.

    • options.indent: Number of spaces for indentation.
    • options.newlineAfterSection: Whether or not to output a newline after the last pair in a hash if that hash wasn't empty.

    Keywords

    Install

    npm i json2toml

    DownloadsWeekly Downloads

    333

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    5.98 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar