lycuid/ruson

Command line json text parsing and processing utility

parsing json compliant with rust and cargo

RUSON

. parsing json compliant with rfc8259. source code does not contain any third party dependencies (why? single source of truth).

  • Installation
    • from source
  • Usage
    • Synopsis
    • Arguments
  • Query Syntax
  • Examples

INSTALLATION

From source.

Requirements:

  • rust and cargo
  • gnu make
git clone --depth=1 https://github.com/lycuid/ruson.git
cd ruson
make && sudo make install

USAGE

SYNOPSIS

ruson [OPTIONS]... FILE

FILE can be replaced with - (hyphen) or skipped entirely to read json text from standard input.

ARGUMENTS

-p, --pretty

Print pretty formatted 'json'.

-t, --table

Print table formatted 'json'.

-q query, --query[=query]

Text for extracting desired json subtree. query text can be any valid javascript syntax of object property accessors or array indexing.

Query Syntax.

Dot notation.

echo '{ "prop": "value" }' | ruson --query '.prop' # "value"

Bracket notation.

echo '{ "prop": "value" }' | ruson --query '["prop"]' # "value"

Array indexing.

echo '{ "prop": [1, 2, 3, 4, 5] }' | ruson --query '.prop[2]' # 3

.keys() Function.

echo '{ "one": 1, "two": 2, "three": 3 }' | ruson -q '.keys()' # ["one", "two", "three"]

.values() function.

echo '{ "one": 1, "two": 2, "three": 3 }' | ruson -q '.values()' # [1, 2, 3]

.length() function.

echo '[1, 2, 3]' | ruson -q '.length()' # 3

.map() function.

echo '{ "list": [{ "id": 1 }, { "id": 2 }, { "id": 3 }] }' | ruson -q'.list.map(.id)' # [1, 2, 3]

EXAMPLES

Download latest xkcd comic

curl https://xkcd.com/info.0.json | ruson -q ".img" | xargs wget

Pokemon attack names.

curl https://pokeapi.co/api/v2/pokemon/pikachu | ruson -q ".moves[0].move.name"

LICENCE

GPLv3

Information - Updated Oct 14, 2021

Stars: 0
Forks: 0
Issues: 0

Repositories & Extras

CLI

317

electron-hardener

A Rust library and command line tool to harden Electron binaries against runtime behavior modifications

electron-hardener

This is a Rust command line tool that calculates a histogram of the separate types...

This is a Rust command line tool that calculates a histogram of the separate types of JSON records in an input JSON log file (one...

This is a Rust command line tool that calculates a histogram of the separate types...

cmsis-pack-manager

is a python module, Rust crate and command line utility for managing current device information that is stored in many CMSIS PACKs

cmsis-pack-manager

Find all your notes with one command!

Todo_r is a simple rust command line utility that keeps track of your todo items in code

Find all your notes with one command!

A Rust command line utility tool to connect to the QuanticTelecom captive portal

So far, the only mode supported so far requires providing password and login

A Rust command line utility tool to connect to the QuanticTelecom captive portal

Rust Command Line Experiment

This is just a little learning exercise on how to write a command line application in rust and manipulate the

Rust Command Line Experiment

A highly-opinionated simplified Find command made with Rust

By default it searches a file/folder in the working directory and divides the result between exact matches and ones that only contain the query

A highly-opinionated simplified Find command made with Rust

Rust command-line program to automatically RSVP new Meetup events

I still haven't gotten meetup's API to respond and haven't heard back from Meetup

Rust command-line program to automatically RSVP new Meetup events
Facebook Instagram Twitter GitHub Dribbble
Privacy