Commit graph

9 commits

Author SHA1 Message Date
Jo-Philipp Wich
592f2dbd82 sh/jshn.sh: allow numbers in identifiers for json_get_var()
When traversing arrays of tables or arrays of array it is required to
call json_select # where # is the index of the array item to select.

Internally json_select() calls json_get_var() to obtain the correct
prefix to populate $JSON_CUR with. However, the "tr" call in
json_get_var() incorrectly replaces all digits with underscores,
making any lookup for numeric array items fail.

The attached patch changes the "tr" expression to allow digits and
thus implements the expected behaviour for nested arrays.
2012-05-16 10:42:37 +02:00
Felix Fietkau
97ed91fa77 jshn.sh: add json_get_vars() wrapper function 2012-05-14 00:21:12 +02:00
Felix Fietkau
738884e746 same for json_get_var 2011-09-11 11:46:44 +02:00
Felix Fietkau
a1a97eb11e jshn: support using characters in elements that do not conform to shell variable restrictions 2011-09-11 11:40:22 +02:00
Felix Fietkau
ec56b91662 jshn: clear more variables on json_init, fix adding array elements 2011-08-11 15:29:23 -06:00
Felix Fietkau
bdf6363777 jshn: add an option for printing the json data without a terminating newline 2011-05-31 15:41:19 +02:00
Felix Fietkau
11079ba582 jshn: fix invalid variable reuse 2011-05-23 23:15:33 +02:00
Felix Fietkau
cc2457aa3e jshn: do not use -n on export 2011-05-23 23:09:19 +02:00
Felix Fietkau
fda6079b30 add jshn 2011-05-23 22:21:27 +02:00