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 🙏

© 2025 – Pkg Stats / Ryan Hefner

json-select

v2.2.0

Published

select json from (very large) json files

Downloads

15,790

Readme

json-select

filter out a portion of a (very large) json file.

Example

pipe a text stream of json into json-select, and pull out just 3 keys per row.

var request = require('request')
var JSONSelect = require('json-select')

request('https://npmjs.org/browserify')
  .pipe(JSONSelect(
    ['versions', true, {name: true, version: true, dependencies:true}]
  ))
  .pipe(process.stdout)

cli tool

to do the same as above, but from bash:

npm install json-select
curl https://npmjs.org/browserify | json-select 'versions.*.{name, version, dependencies}'

the selector can be either valid json, or the terse syntax as in this example.

use on a js object

var select = require('json-select/select')

select(
//the object to select from
{
  hello: [
    {foo: 1, bar: 2, baz: {whatever: true}},
    {foo: 3, bar: 13, baz: {whatever: false}},
    {foo: 70, bar: 77, baz: {whatever: null}}
  ]
},

['hello', true, {foo: true, BAR: 'bar', z: ['whatever']}])

//outputs ==>

[
  {foo: 1, BAR: 2, z: true},
  {foo: 3, BAR: 13, z: false},
  {foo: 70, BAR: 77, z: null}
]

Selector Syntax

The selector syntax is based on JSONStream, except you can provide an object which collects values the object. the object can be a {} object or an array. each value can be a string, a boolean or an array.

key: (string) name

allows you to map to a different named key. set {key: data[name]}

key: true

short hand for {key: key}

set {[name]: data[name]}

key: [path...]

extract the value from the given path, this can contain selectors.

Usage

json-select can also be used as a command, if you npm install json-select -g

json-select [selector] --arrays? < json_source
  # path is a json array indicating the selector into the json file.
  # if --arrays is passed, any unmatched groups will default to arrays.

License

MIT