Skip to content
Stringify an object/array like JSON.stringify just without all the double-quotes
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.editorconfig
.gitattributes
.jshintrc
.npmignore
.travis.yml
component.json
contributing.md
package.json
readme.md

readme.md

stringify-object Build Status

Stringify an object using a custom indentation

Node.js

Install and add to package.json using NPM: npm install --save stringify-object

var stringifyObject = require('stringify-object');
var pretty = stringifyObject({foo: 'bar'}, '  ');
console.log(pretty);
/*
{
  foo: 'bar'
}
*/

Browser

Available on Bower: bower install stringify-object or manually download it.

<script src="object-stringify.js"></script>
var pretty = stringifyObject({foo: 'bar'}, '  ');
console.log(pretty);
/*
{
  foo: 'bar'
}
*/

Documentation

stringifyObject(obj, [indentation])

Accepts a plain object and stringifies it with a custom indentation (default tab).

License

BSD license and copyright Google

Something went wrong with that request. Please try again.