bjorne / jku Goto Github PK
View Code? Open in Web Editor NEWCommand-line JSON stream filter and transformer
Command-line JSON stream filter and transformer
Accessing a hash within a hash is very cumbersome as it requires many safeguards to be placed to avoid jku from crashing if an object doesn't exist. See this example
(_.connections && _.connections.length && _.connections.reduce(function(m, c){ return (c.scope == "burt.beacon" && (c.name == "customer_id_type_1" || c.name == "customer_id_type_2")) ? "logged-in" : m }, "") || "not-logged-in")
it would be nice if this could be written something like:
_.connections[?(@.scope=="burt.beacon" && @.name==/(customer_id_type_1|customer_id_type_2)/)] ? "logged-in" : "not-logged-in"
given that the program "decorate" exists, accepting 2 args - type of data to decorate and key, example being decorate day_of_week 1399248007040, it would ROCK if I could write the following:
jku -t '[_.timestamp, decorate(day_of_week, _.timestamp)]'
and get the output:
1399248007040\tMonday
if the shell command returns non-zero exit code, jku should abort
Hello mr. Bjorn.
It's not in my nature to ask other people for favors (unless sexual), but I'm too lazy in this case.
I would like an option that works similar to transformers. The option takes one or more arguments and will for each JSON line, only include attributes that are specified as arguments to the option. For example:
{"one": "lorem", "two": "ipsum", "three": "dolor"}
{"one": "amet", "two": "consequat", "three": "tortor"}
{"one": "quis", "two": "fermentum", "three": "magna"}
Running this:
$ cat ABOVE-FILE | jku --some-option one three
Would produce this:
{"one": "lorem", "three": "dolor"}
{"one": "amet", "three": "tortor"}
{"one": "quis", "three": "magna"}
Could you please implement this for me sugar?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.