Socket
Book a DemoInstallSign in
Socket

jstransformer-json

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstransformer-json

A transformer that minifies or beautifies JSON.

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

jstransformer-json

Transformer that minifies or beautifies JSON

Build Status Coverage Status NPM version

Installation

npm install jstransformer-json

API

var json = jstransformer(require('jstransformer-json'))
  , obj  = '{          "thisIsAnObject": true,\n    "that"      : [\n        "adsf","af"\n       ],\n    "este": "sí"\n}'

// when options or options.beautify is undefined, the resulting JSON is
// minified.

json.render(obj)
=> { body: '{"thisIsAnObject":true,"that":["adsf","af"],"este":"sí"}',
     dependencies: [] }

// options.beautify is the indentation used to beautify the JSON source
// (internally it is passed as the third argument to JSON.stringify()).

json.render(obj, { beautify: '    ' })
=> { body: '{\n    "thisIsAnObject": true,\n    "that": [\n        "adsf",\n        "af"\n    ],\n    "este": "sí"\n}',
     dependencies: [] }

json.render(obj, { beautify: '@@' })
=> { body: '{\n@@"thisIsAnObject": true,\n@@"that": [\n@@@@"adsf",\n@@@@"af"\n@@],\n@@"este": "sí"\n}',
     dependencies: [] }

License

MIT

Keywords

jstransformer

FAQs

Package last updated on 14 Feb 2015

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