New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json2toml

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json2toml

JSON to TOML converter

  • 6.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.1K
decreased by-4.96%
Maintainers
0
Weekly downloads
 
Created
Source

json2toml

Convert JSON to TOML.

Example

const 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

const 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.

Throws a TypeError if undefined, null, or a sparse array is encountered.

Keywords

FAQs

Package last updated on 27 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc