3 ms·
My jq killer: function ruby_json { ruby -e "require 'json'; require 'active_support/all'; puts JSON.parse(STDIN.read)$1" } Performs/prints arbitrary r
by vemv 10y ago
My jq killer:
function ruby_json {
ruby -e "require 'json'; require 'active_support/all'; puts JSON.parse(STDIN.read)$1"
}
Performs/prints arbitrary ruby over a readily available representation of the JSON object coming from stdin.
Example:
curl the_endpoint | ruby_json "['funnels'].map{|a| puts a.to_i * 2 }"
- svs 10y agoCannot accept user inputted script for json transform because Security nightmare! That's JQ's and JMESPath's secret sauce.