Pure Go implementation of jq
ltrim
, rtrim
, and trim
functionsgojq.ParseError
for getting the offset and token of query parsing errorgojq.HaltError
for detecting halt errors and stopping outer iteration{x:0,y:1} | {a:.x,a:.y}
)halt
and halt_error
functions to stop the command execution immediately"a" as $v | def f: $v; "b" as $v | f
)$ARGS
in ~/.jq
)ltrimstr
and rtrimstr
functions to emit error on non-string inputnearbyint
and rint
functions to round ties to evenreduce
, foreach
, if
, try
-catch
syntax as object valuespow10
in favor of exp10
, define scalbn
and scalbln
by ldexp
abs
, pick
, and debug/1
functions--raw-output0
option, and remove --nul-output
(-0
) optionnan
nan
if either side is nan
implode
function to emit replacement characters on invalid code pointsstderr
function to output strings in raw formaterror
function to throw an error even for null
walk
function on multiple outputs arguments--from-file
option to work with --args
and --jsonargs
options../lib
relative to the executablemodulemeta
function to include defined function names in the moduleimport
and include
directives to support $ORIGIN
expansionleaf_paths
function@urid
format string to decode URI valuesflatten
, group_by
,
unique
, unique_by
, nth
, indices
, path
, and modulemeta.deps
)=
) with overlapping paths and multiple values ([[]] | .. = ..
)9223372036854775807 * ""
)=
) with multiple values (. = (0,0)
)isnormal
and normals
functions against subnormal numbersbreak
in try
-catch
query (label $x | try break $x catch .
)getpath
function (path(getpath([[0]][0]))
)walk
function with argument emitting multiple values ([1],{x:1} | walk(.,0)
)@csv
, @tsv
, @sh
to escape the null character (["\u0000"] | @csv,@tsv,@sh
)=
), update-assignment operator (|=
),
map_values
, del
, delpaths
, walk
, ascii_downcase
, and ascii_upcase
functionsfromjson
to emit error on unexpected trailing stringdef f($x): .y; path(f(.x))
)--raw-input
(-R
) to keep carriage returns and support 64KiB+ linesgojq.Compare
for comparing values in custom internal functionsgojq.TypeOf
for obtaining type name of values in custom internal functionsgojq.Preview
for previewing values for error messages of custom internal functions"\ud83d\ude04"
)def empty: .; null | select(.)
)null
("abc" | .[3]
)"abc" as [$a] ?// $a | $a
)sub
and gsub
functions to emit results in the same order of jqfromjson
to keep integer precision ("10000000000000000" | fromjson + 1
)mktime
to support nanoseconds, just like gmtime
and now
{} | {}.x = 0
, [0] | [.[]][] = 1
).
Also optimize constant indexing and slicing by specialized instructionadd
(on array of strings), flatten
, min
, max
,
sort
, unique
, join
, to_entries
, from_entries
, indices
, index
,
rindex
, startswith
, endswith
, ltrimstr
, rtrimstr
, explode
,
capture
, sub
, and gsub
functionstry 0 * error(0)
)0 | .x[]?
)input
, inputs
functionsisempty
function--args
, --jsonargs
, $ARGS.positional
)delpaths
function with overlapped paths--exit-status
flag with halt
, halt_error
functionsinput_filename
function with null input optionnan
if 0 then . else 0|0 end
)range
, join
, flatten
functionsgo-flags
package