Array: Difference between revisions

Line 71:
Assuming a and b are arrays, and if m and n are non-negative integers:
<lang jq>
[][n] = null # => an array with (1+n) nulls
[range(0;n)] # => [0,1, ... (n-1)]
a | length # => the length of a
Line 78:
a[-1] # => the last element (or null)
a[m:n] # => the subarray [a[m], ..., a[n-1]]
</lang>
 
====Streams and Arrays====
jq provides support for streams of JSON entities, and thus the syntax for converting between an array and the stream of entities that an array contains is fundamental to jq. In brief:
2,503

edits