GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - slice/json: A tiny Node.js CLI script to access JSON from stdin.

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

json

a tiny utility for working with json from stdin

installation

requires node 8+.

$ npm i -g @slicey/json

usage

output is prettified for complex structures, and is not shortened. it is also colored if stdout is a tty :)

# access from stdin:

$ curl -s https://httpbin.org/headers | json headers.User-Agent
'curl/7.54.0'

$ cat file.json | json mystery.fortune
'👀'

# arrays work:

$ echo '[1, 2, 3]' | json 0
1

# and so do objects:

$ echo '{ "hello there": "warm goodness" }' | json 'hello there'
'warm goodness'

# get you a shibe:

$ curl -s shibe.online/api/shibes | json 0 | xargs open # macOS
$ curl -s shibe.online/api/shibes | json 0 | xargs xdg-open # Linux

# direct file access? no prob:

$ json package.json bin.json
'bin/json'

$ json file.json subobject.another_subobject.subarray.2
'wow this is inside of an array'

# pretty printing too!

$ json package.json
{
  name: '@slicey/json',
  description: 'Quickly access JSON from stdin.',
...

# works with stdin also:

$ cat mysteries.json | json
[
  {
    created_at: '2009-01-05',
    text: 'Where\'s my Cup Noodles?'
  },
  {
    created_at: '2009-01-06',
    text: 'My Cup Noodles have arms?'
  }
...

motivation

bored on a thursday

About

A tiny Node.js CLI script to access JSON from stdin.

Topics

jsonjson-cli

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.