Live data from Hacker News

Show HN: Jb / json.bash – Command-line tool (and bash library) that creates JSON

github.com

51–56 of 56 posts

Re: Show HN: Jb / json.bash – Command-line tool (and bash library) that creates JSON

#52
jq has quite a few more ways to input things more than from stdin and files. Some examples:

  $ abc=123 jq -cn '$ENV | {abc, othername: .abc}'
  {"abc":"123","othername":"123"}

  $ jq -cn --arg abc 123 '{$abc, othername: $abc}'
  {"abc":"123","othername":"123"}

  $ jq -cn --argjson abc 123 '{$abc, othername: $abc}'
  {"abc":123,"othername":123}

Re: Show HN: Jb / json.bash – Command-line tool (and bash library) that creates JSON

#53
post #7

Windows: what if everything was an (command) object? Linux: what if everything was a file? Soon we might have... Mong/Os: what if everything was JSON? YiAM/OS: YiAM/OS is ANOTHER MARKUP OPERATING SYSTEM... would come out shortly thereafter... I like JSON and getting in the terminal is a challenge - GOOD JOB!

Kubernetes already got you covered: What if everything was a YAML?

Re: Show HN: Jb / json.bash – Command-line tool (and bash library) that creates JSON

#54
post #37

Earlier quoted context omitted.

Two main situations I think. The first is just interactive use in any shell to encode ad-hoc JSON. If you have a next-gen shell which can handle structured data directly, then you probably don't need it. Second is situations where you'd rather not add an additional dependency, but bash is pretty much a given. For example, CI environments, scripts in dev environments, container entrypoints. Or things that area already…

> Second is situations where you'd rather not add an additional dependency, but bash is pretty much a given. For example, CI environments, scripts in dev environments, container entrypoints. Or things that area already written in bash. Is this tool not an additional dependency? > But bash is just really ubiquitous Biggest crime of the Unix world probably.

> Is this tool not an additional dependency?

"Dependency" generally means "external dependency".

It's only a dependency if your solution's build process fetches it from its upstream repo. (Or worse: it's just mentioned in some manual build instructions as one of the things your solution needs.)

This is small enough to copy into the source tree of your solution, in which case it's no longer a dependency.

Post reply on HN