diff options
author | Christian Beier <dontmind@freeshell.org> | 2018-01-18 23:21:09 +0300 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-01-22 11:21:03 +0300 |
commit | 9c4aeda96220b3f0d097d153bedd328f71f382bf (patch) | |
tree | bf6f5a1a5030a132e092e8f020d41dfe10067bf6 /sh | |
parent | 1c08e80313fd487112c48346889cc57badeef751 (diff) |
jshn: add functionality to read big JSON
The existing read functionality feeds the complete JSON to jshn as a
cmdline argument, leading to `-ash: jshn: Argument list too long`
errors for JSONs bigger than ca. 100KB.
This commit adds the ability to read the JSON directly from a file if
wanted, removing this shell-imposed size limit.
Tested on x86-64 and ar71xx. An mmap()-based solution was also evaluated,
but found to make no performance difference on either platform.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
Diffstat (limited to 'sh')
-rw-r--r-- | sh/jshn.sh | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -180,6 +180,10 @@ json_load() { eval "`jshn -r "$1"`" } +json_load_file() { + eval "`jshn -R "$1"`" +} + json_dump() { jshn "$@" ${JSON_PREFIX:+-p "$JSON_PREFIX"} -w } |