Skip to content

Instantly share code, notes, and snippets.

@cablehead
Created May 23, 2026 15:10
Show Gist options
  • Select an option

  • Save cablehead/3a5bc5c85714408f01a4d20914bf1548 to your computer and use it in GitHub Desktop.

Select an option

Save cablehead/3a5bc5c85714408f01a4d20914bf1548 to your computer and use it in GitHub Desktop.
python -c json piping vs nushell

python -c vs. nushell for JSON

Two ways to pull stargazers_count off the nushell repo's GitHub API response. Both verified against https://api.github.com/repos/nushell/nushell.

One field

bash + python -c:

curl -s https://api.github.com/repos/nushell/nushell \
  | python3 -c 'import sys,json; print(json.load(sys.stdin)["stargazers_count"])'
# 39557

nushell:

http get https://api.github.com/repos/nushell/nushell | get stargazers_count
# 39557

http get already decodes the JSON response into a structured record, so get stargazers_count is just a field access. No second runtime, no stdin plumbing.

Three fields

bash + python -c:

curl -s https://api.github.com/repos/nushell/nushell \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['stargazers_count'], d['open_issues_count'], d['default_branch'])"
# 39557 1487 main

nushell:

http get https://api.github.com/repos/nushell/nushell | select stargazers_count open_issues_count default_branch
+-------------------+-------+
| stargazers_count  | 39557 |
| open_issues_count | 1487  |
| default_branch    | main  |
+-------------------+-------+

The python line is also a live demonstration of why this matters for agents: the f-string version of it blew up on shell-vs-python quote escaping and had to be retried with different quoting. The nushell version has no escaping surface -- the record stays typed end to end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment