jq, json.tool, or Browser Formatter: A Practical Guide to Pretty-Printing curl JSON
Developers routinely deal with minified JSON responses from curl commands and typically rely on one of three formatting tools depending on the situation. jq is the fastest and most capable option, supporting filtering and precise error reporting, but may not be available in minimal container or CI environments. Python's built-in json.tool serves as a reliable fallback where jq cannot be installed, though it lacks filtering capabilities. Browser-based formatters are useful when sharing output with teammates, but a security disclosure revealed that popular online formatters had retained over 80,000 snippets containing sensitive credentials like AWS keys and JWTs. Regardless of the tool used, stripping sensitive fields such as tokens, passwords, and internal IDs with jq's del() function before sharing any payload is a recommended but often overlooked step.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in