I wonder if I could use this on my project which uses multiple glue functions to piece together JSON strings. https://github.com/fieu/discord.sh
This example uses the pattern of setting an out=varname when calling a json function, the encoded JSON goes into $varname variable. This pattern avoids the overhead of forking processes (e.g. subshells) when generating JSON.
Otherwise you can use the more normal approach of jb writing to stdout, and capturing the output stream.