All Projects → yannick-cw → sjq

yannick-cw / sjq

Licence: other
Command-line JSON processor with Scala syntax

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sjq

jsqry-cli2
Small CLI tool (similar to jq) to query JSON using sane DSL
Stars: ✭ 21 (-61.11%)
Mutual labels:  jq
pjs
An awk-like command-line tool for processing text, CSV, JSON, HTML, and XML.
Stars: ✭ 21 (-61.11%)
Mutual labels:  jq
cheatsheets
My Cheatsheet Repository
Stars: ✭ 193 (+257.41%)
Mutual labels:  jq
json to paths
Distill a JSON document into a collection of paths both for 'jq' and 'xpath'
Stars: ✭ 65 (+20.37%)
Mutual labels:  jq
ijq
Interactive jq (mirror)
Stars: ✭ 100 (+85.19%)
Mutual labels:  jq
atom-jq
[unmantained] A playground for jq inside atom
Stars: ✭ 22 (-59.26%)
Mutual labels:  jq
Jq Web
jq in the browser with emscripten.
Stars: ✭ 188 (+248.15%)
Mutual labels:  jq
onymous-plurk
Anonymous Plurk Cross-matching Tool - Plurk偷偷說交叉比對工具
Stars: ✭ 20 (-62.96%)
Mutual labels:  jq
jq-zsh-plugin
jq zsh plugin
Stars: ✭ 155 (+187.04%)
Mutual labels:  jq
vscode-jq
jq LiveView Extension for VS Code
Stars: ✭ 15 (-72.22%)
Mutual labels:  jq
jqjs
Pure-JavaScript implementation of the jq JSON query language
Stars: ✭ 39 (-27.78%)
Mutual labels:  jq
jqkungfu
A jq playground, written in WebAssembly
Stars: ✭ 108 (+100%)
Mutual labels:  jq
biowasm
WebAssembly modules for genomics
Stars: ✭ 115 (+112.96%)
Mutual labels:  jq
ycat
Command line processor for YAML/JSON files using Jsonnet
Stars: ✭ 21 (-61.11%)
Mutual labels:  jq
ghrecipes
⛔ ARCHIVED ⛔ Provides some helper functions for using the GitHub V4 API
Stars: ✭ 28 (-48.15%)
Mutual labels:  jq
jq-tutorial
Interactive exercises for learning jq
Stars: ✭ 109 (+101.85%)
Mutual labels:  jq
SciFi Conky HUD
SciFi theme for Conky
Stars: ✭ 33 (-38.89%)
Mutual labels:  jq
jqmd
Write and document your jq/shell scripts with markdown
Stars: ✭ 24 (-55.56%)
Mutual labels:  jq
api-test
🌿 A simple bash script to test JSON API from terminal in a structured and organized way.
Stars: ✭ 53 (-1.85%)
Mutual labels:  jq
gosquito
gosquito ("go" + "mosquito") is a pluggable tool for data gathering, data processing and data transmitting to various destinations.
Stars: ✭ 25 (-53.7%)
Mutual labels:  jq

sjq

About

Use Scala syntax to modify json fast and however you want from the Commandline.

Just pass code to modify the root case class. sjq parses the json to a case class and allows editing and modifying it in any way.

e.g.

sjq -a 'root.subclass.copy(name = root.subclass.name + "Jo")' -j '{ "subclass": { "name": "Ho", "ids": [22, 23, 24]  }}'
{
  "name" : "HoJo",
  "ids" : [
    22.0,
    23.0,
    24.0
  ]
}

One example with a more complex json and a remote api:

Get all hotel names with a score over 300
curl https://www.holidaycheck.de/svc/search-api/search/mall\?tenant\=test \
| sjq -a 'root.destinations.entities.filter(_.rankingScore > 300).map(_.name)'

returns

[
  "Mallorca",
  "Malles Venosta / Mals",
  "Palma de Mallorca"
]

Install

brew install yannick-cw/homebrew-tap/sjq

Or download the executable from the releases.

Usage

You can pass any valid scala code to access the json, the json is internally represented as a case class.

The input to use is the case class root

sjq -a 'root.subclass.ids.filter(id => id > 22)' -j '{ "subclass": { "name": "Ho", "ids": [22, 23, 24]  }}'
## Results in 
[
  23.0,
  24.0
]

Alternatively pipe input

echo '{ "subclass": { "name": "Ho", "ids": [22, 23, 24]  }}' | sjq -a 'root.subclass.ids.filter(id => id > 22)'

Planned features

  • support subclasses with the same name with different value types
  • interactive mode with auto complete on json
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].