]> git.corax.cc Git - toolbox/commit
include/json: Add functions for manipulating JSON arrays
authorMatthias Kruk <matthias.kruk@miraclelinux.com>
Fri, 28 May 2021 12:12:16 +0000 (21:12 +0900)
committerMatthias Kruk <matthias.kruk@miraclelinux.com>
Fri, 28 May 2021 12:12:16 +0000 (21:12 +0900)
commitb3cf44567d9a01f8bdba85ddcf5df2f3d070d55d
tree3dba872d309c4216ea44976663bc60fe4126ed9d
parent9069bf91b58280cd67634e4c3f0af0b5e435a8d8
include/json: Add functions for manipulating JSON arrays

Handling JSON arrays in shell scripts can be painful without jq. This
commit adds a number of convenience functions that wrap jq to make
array handling easier. The follow fuctions are added:
 - json_array_head(): Returns the first element of a JSON array
 - json_array_tail(): Returns a new JSON array without the first element
 - json_array_to_lines(): Returns all elements of a JSON array, one per line
include/json.sh