# HG changeset patch # User iuc # Date 1499207388 14400 # Node ID 5ff75eb1a893d05a9a36156c22533b0ca2d68d17 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jq commit 09e822fb844c9c724eb03dd12f352577ef404ea8 diff -r 000000000000 -r 5ff75eb1a893 jq.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jq.xml Tue Jul 04 18:29:48 2017 -0400 @@ -0,0 +1,120 @@ + + + process JSON + + jq + + '$output' + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `__ for a much +more detailed guide on using JQ. + +Select an Attribute +~~~~~~~~~~~~~~~~~~~ + +Given an input like the following + +:: + + {"foo": 42, "bar": "less interesting data"} + +To select just the value of ``foo``, supply the filter ``.foo`` + +Loop over an Array +~~~~~~~~~~~~~~~~~~ + +Given an input like the following + +:: + + [{"foo": 1123}, {"foo": 6536}, {"foo": 5321}] + +To select the values of ``foo``, supply the filter ``.[].foo`` or +``.[] | .foo``. This will produce a file with one number per line. + +If you wish to select multiple things: + +:: + + [{"foo": 1123, "bar": "a"}, {"foo": 6536, "bar": "b"}, {"foo": 5321, "bar": "c"}] + +To select the values of ``foo`` AND ``bar``, supply the filter +``.[] | [.foo, .bar]``. This will produce and output array like: + +:: + + [ + [1123, "a"] + [6536, "b"] + [5321, "c"] + ] + +A common next step is to turn this into a tabular output which more +Galaxy tools can work with. This can be done by checking the box for +tabular. This will invoke the JQ filter of ``@tsv`` at the end of the +processing chain, and produce a tabular file. + + ]]> + + diff -r 000000000000 -r 5ff75eb1a893 test-data/list.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/list.json Tue Jul 04 18:29:48 2017 -0400 @@ -0,0 +1,1 @@ +[{"foo": 1123, "bar": "a"}, {"foo": 6536, "bar": "b"}, {"foo": 5321, "bar": "c"}] diff -r 000000000000 -r 5ff75eb1a893 test-data/out-1.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out-1.json Tue Jul 04 18:29:48 2017 -0400 @@ -0,0 +1,3 @@ +1123 a +6536 b +5321 c