Skip to content

Releases: Tirito6626/bash2json

v3.6.2

11 Jul 15:02

Choose a tag to compare

  • fix for JSON objects which contain - not being parsed as input
  • fix for ' ': command not found in json_query and bash2json

v3.6.1

11 Jul 13:45

Choose a tag to compare

hotfix for int values not being valid

v3.6.0

11 Jul 13:31

Choose a tag to compare

reworked option --output:
--output=<filename> redirects output to file instead of standart output
output name option is moved to --from-json as second argument
yet another big update for --query:
--query now 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)
--pretty supports multiple JSON objects as input
--from-json doesn't put extra quotes on strings but keeps double quotes

v3.5.0

10 Jul 22:21

Choose a tag to compare

why not v3.4.0? because I find this update important enough, to be v3.5.0:

main changes:

  • --stdin and --input options are removed, instead bash2json automatically 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

  • bash2json function now stores each action's output as output variable and THEN returns it. it's made for new --pretty update, which now acts as action and as modifier: if --pretty is 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)

  • error now doesn't return any exit code and only writes into STDERR

  • json_trim now supports validate option to automatically validate JSON and trim it. this change is made to make --trim as fast as possible, making it run twice without extra json_validate

  • json_validate's code optimization for better perfomance and readability.

  • fixed multiple bugs with new json_query not properly parsing arrays and returning extra quotes with strings

v3.3.0

04 Jul 15:43

Choose a tag to compare

Added --pretty action for pretty JSON output
Fixed small bugs related to input reading and json_query

v3.2.0

04 Jul 11:45

Choose a tag to compare

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

04 Jul 10:14

Choose a tag to compare

Fixed json_query returns extra comma when fetching string

v3.1.1

02 Jul 21:29

Choose a tag to compare

Fixed json_query returning error inside json_append and json_append wrongly parsing keys inside arrays

v3.1.0

01 Jul 17:06

Choose a tag to compare

Version mainly dedicated to json_query rework:

  • json_query is 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

28 Jun 20:54

Choose a tag to compare

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_trim and 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>_output instead 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_validate now also checks for escaped characters and missing commas.
  • Most functions were tested multiple times, but there still can be bugs during parsing.