Releases: Tirito6626/bash2json
v3.6.2
v3.6.1
hotfix for int values not being valid
v3.6.0
reworked option
--output:
--output=<filename>redirects output to file instead of standart output
output name option is moved to--from-jsonas second argument
yet another big update for--query:
--querynow fully supports multiquery and multiindex with arrays:
all queries should be delimited by either(space) or;(semicolon with space). if delimited with space, output will be returned in one line, values will be split with space. otherwise output values are split with newline (\n)
arrays now support[index1(,|;)index2,...]syntax. if indexes are delimited with comma, they are returned in one line and split with spaces, if delimited with semicolon, output values are split with newline (\n)
--prettysupports multiple JSON objects as input
--from-jsondoesn't put extra quotes on strings but keeps double quotes
v3.5.0
why not v3.4.0? because I find this update important enough, to be v3.5.0:
main changes:
-
--stdinand--inputoptions are removed, insteadbash2jsonautomatically defines the input, whether it's JSON, filename or a symlink -
all functions have proper error handling and exit codes system. each function now returns either exit code 0 (success) or exit code 1 (failed) with error in STDERR
-
bash2jsonfunction now stores each action's output asoutputvariable and THEN returns it. it's made for new--prettyupdate, which now acts as action and as modifier: if--prettyis combined with any action, it runs after the action and makes the final output pretty. if it's supplied without any other actions, it becomes an action and returns pretty output from original input. storing final output is also useful when implementing other modifiers in the future (for example JSON highlight) -
errornow doesn't return any exit code and only writes into STDERR -
json_trimnow supportsvalidateoption to automatically validate JSON and trim it. this change is made to make--trimas fast as possible, making it run twice without extrajson_validate -
json_validate's code optimization for better perfomance and readability. -
fixed multiple bugs with new
json_querynot properly parsing arrays and returning extra quotes with strings
v3.3.0
Added --pretty action for pretty JSON output
Fixed small bugs related to input reading and json_query
v3.2.0
bash2json is officially not forking any processes and doesn't use any subshells.
--stdin is now optional: bash2json automatically checks if standart input is empty or not
v3.1.2
Fixed json_query returns extra comma when fetching string
v3.1.1
Fixed json_query returning error inside json_append and json_append wrongly parsing keys inside arrays
v3.1.0
Version mainly dedicated to json_query rework:
json_queryis now fully independent from other functions and supports multiquery (delimited by space).- Fixed backslash not parsing correctly
json_validate now fully captures and validates values. Integers and floats are fully supported now.
v3.0.0
I consider this a major update due to HUGE perfomance improvements and overall structure.
Speed comparison is posted here
Each function was reworked for better perfomance. Separate function perfomance comparisons will be posted later
- Most functions are independent from
json_trimand automatically trim all spaces outside strings - Each function now has "sub" argument, which defines if output is returned or not. Each function's output is stored as
<function name>_outputinstead of echoing it for capture. It's made mostly for recursive functions which can now just save the output/use the variable directly, rather than spawning a subshell. json_validatenow also checks for escaped characters and missing commas.- Most functions were tested multiple times, but there still can be bugs during parsing.