stringify-json-object
Stringify and format a JSON object.
Last updated 4 years ago by bconnorwhite .
MIT · Repository · Original npm · Tarball · package.json
$ gnpm install stringify-json-object 
SYNC missed versions from official npm registry.

stringify-json-object

NPM TypeScript Coverage Status

Stringify and format a JSON object.

If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter


Installation

yarn add stringify-json-object
npm install stringify-json-object
pnpm add stringify-json-object

Usage

The stringify function works like JSON.stringify:

import stringify from "stringify-json-object";

stringify(true); // 'true'
stringify(1); // '1'
stringify("foo"); // '"foo"'
stringify({ foo: "bar" }); // '{"foo":"bar"}'
stringify({ foo: "bar", missing: undefined }); // '{"foo":"bar"}'

The stringify function also accepts an options argument, to easily format the output:

import stringify from "stringify-json-object";

stringify({ foo: "bar" }, { pretty: true }); // '{\n  "foo": "bar"\n}"

Additionally, primitives resolve to typed string literals:

import stringify from "stringify-json-object";

stringify(true); // "true"
stringify(1); // "1"
stringify("foo"); // "\"foo\""
stringify({ foo: "bar" }); // string


Dependenciesdependencies


Dev Dependencies

  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

License license

MIT


Related Packages

Current Tags

  • 3.0.0                                ...           latest (2 years ago)

10 Versions

  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.7                                ...           4 years ago
  • 1.0.6                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |