bash python

Parse JSON Using Python in Bash Command Line

This article introduces how to parse JSON using Python on the Bash command line on Linux PC/server. When JSON comes back from curl, there are times when you want to easily parse it. <pre><code>echo '{"url" "google.com"}' | python -c 'import json,sys;print json.load(sys…

Shou Arisaka
1 min read
Nov 20, 2025

This article introduces how to parse JSON using Python on the Bash command line on Linux PC/server.

When JSON comes back from curl, there are times when you want to easily parse it.

echo '{"url": "google.com"}' | python -c 'import json,sys;print json.load(sys.stdin)["url"]'
# or
echo '{"url": "google.com"}' | python3 -c 'import json,sys;print(json.load(sys.stdin)["url"])'

sys.stdin is the piped output.

Share this article

Shou Arisaka Nov 20, 2025

🔗 Copy Links