JSON
stands for JavaScript Object Notation and represents easy-to-read lightweight data format. And jq
is basically described as sed
for JSON data, hence used for JSON data parsing. Here’s a basic parsing JSON including a jq example.
Prerequisites
- jq
Solution
Example JSON data:
{
"name": "bob",
"lastname": "brady",
"description": "loremipsum"
}
Expected plain text output:
name=bob
lastname=brady
description=loremipsum
One of the many jq
solutions:
jq -r 'to_entries[] | "\(.key)=\(.value)"'
Conclusion
On a side note, follow our official channel on Telegram.