json,

JSON to plain text using JQ

Mar 09, 2022 · 1 min read · Post a comment
JSON to plain text using JQ

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 parcing. Here’s a basic parsing JSON with 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.