npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fabulous-json

v1.0.3

Published

Yet another JSON stringifier that outputs fabulous-looking JSON strings.

Readme

fabulous-json

Yet another JSON stringifier that outputs fabulous-looking JSON strings.

Installation

npm i fabulous-json

Usage

import stringify from 'fabulous-json'

const obj = { a: 'Hello world!', b: [ 1, 2, 3, 4 ] }

const jsonString = stringify(obj, { maxLineLength: 80 })

Output Example

This example shows how arrays and objects can be inlined, and how they can form tables with property keys and values in columns:

{
  "color": [ 1, 0.4, 0.2, 1 ],
  "brightness": {
    "function": "Linear",
    "loop": false,
    "keyframes": [
      { "position": 0,   "value":  12.8 },
      { "position": 0.1, "value": 102.4 },
      { "position": 0.2, "value":  51.2 },
      { "position": 1,   "value":   0   }
    ]
  }
}

Options

replace

Replacer function that works just like the one in JSON.stringify. This only acts as the replacer function, not the array of property names that JSON.stringify also accepts.

indent

Either the string to use as the indent, or the number of spaces to use as it.

Defaults to 2.

prefixIndent

Either a string to add to the start of indented lines, or a number of spaces to add instead. This can be useful for generating JSON strings that are going to be inserted into other indented text.

Defauls to 0.

allowInline

A function that determines if an array or object is allowed to be inlined. The other rules still apply, but this function can be used to stop certain values from being inlined.

maxLineLength

The maximum total length of a line, not including indentation.

Defaults to 100.

maxArrayItems

The maximum number of items in inline arrays. Arrays exceeding this limit will be split into multiple lines.

Defaults to 6.

maxObjectProperties

The maximum number of properties in inline objects. Objects exceeding this limit will be split into multiple lines.

Defaults to 6.

maxArrayItemLength

The maximum length of items in inline arrays. Arrays containing items that exceed this limit will be split into multiple lines.

Defaults to half of maxLineLength.

compactLongArrays

Controls if long arrays should be made more compact or not. Compact long arrays will try to fit items into a roughly square shape.

Defaults to true.

tables

Controls if arrays and objects should be formatted like tables if the structure of their contents allow it.

Defaults to true.

tableArrays

Controls if arrays should be formatted like tables if the structure of their contents allow it. Requires tables to be enabled.

Defaults to true.

tableObjects

Controls if objects should be formatted like tables if the structure of their contents allow it. Requires tables to be enabled.

Defaults to true.

allowTable

A function that determines if an array or object is allowed to be formatted as a table. The other rules still apply, but this function can be used to stop certain values from being turned into tables.

tableMinSharedKeys

For an array or object that contains objects to be formatted as a table, the contained objects require this many shared keys that exist in all of them. If there are fewer than this amount of shared keys between the contained objects, the parent array or object will not be formatted as a table.

Defaults to 1.

tablePadEndOfRows

Controls if the ends of rows in a table should be padded such that the closing brackets all line up or not. If disabled, the closing brackets will be placed after the last filled column in each row instead.

Defaults to true.

tableDecimalAlignment

Align numbers in tables such that the decimal point is always in the same column. This makes it easier to see the difference between large numbers vs. precise ones, for example 10000 vs 0.0001.

Defaults to true.