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 🙏

© 2024 – Pkg Stats / Ryan Hefner

json2fson

v1.0.15

Published

JavaScript Object Notation to FileSystem Object Notation

Downloads

35

Readme

json2fson

contributions welcome Build Status

JavaScript Object Notation to FileSystem Object Notation (json to fson) and back

Converts a JSON to a FSON and back:

Current status: Early alpha!

Installation

npm install --save json2fson

Usage

var json2fson = require("json2fson")

var data = {
  //The object you want to convert
  name: "John Doe",
  age: 20,
  colors: ["red", "green", "blue"],
  friends: {
    goodOnes: [
      {
        NAME: "Foo",
        AGE: 20,
      },
      {
        NAME: "Bar",
        AGE: 30,
      },
    ],
    OTHERS: [
      {
        NAME: "FooBar",
        AGE: 25.5,
      },
    ],
  },
  homeAddress: "Main St. #180",
}

json2fson.convert({ data: data })

Will create the following structure and contents inside the DB folder (./fson/ by default):

  • ./
    • fson/
      • data/
        • name (file containing "John Doe")
        • age (containing 20)
        • colors/
          • 0 ("red")
          • 1 ("green")
          • 2 ("blue")
        • friends/
          • good_ones/
            • 0/
              • _n_a_m_e _("Foo")_
              • _a_g_e _(20)_
            • 1/
              • _n_a_m_e _("Bar")_
              • _a_g_e _(30)_
          • _o_t_h_e_r_s/
            • 0/
              • _n_a_m_e _("FooBar")_
              • _a_g_e _(25.5)_
        • home*address *("Main St. #180")_

Running tests

Do npm install and npm test to create the FSON above.

FSON rules

The following rules are followed:

  • Plain objects and arrays (strictly {...} and [...]) are folders
  • Keys are files and values are file contents (i.e the object { name: "John" } will create a file called "name" containing "John").
  • Uppercase letters have a leading low dash "_" since OS' paths are not always case sensitive.

License

MIT © @adelriosantiago