jsonjq

JSON to plain text using jq


Let's say i got the following json response:

{
  "author": "tomek",
  "title": "helloworld",
  "test": "sampletextonetwothree"
}

Is it possible to display something like this: (using jq)

author=tomek
title=helloworld
test=sampletextonetwothree

Solution

  • jq -r 'to_entries[] | "\(.key)=\(.value)"'
    

    should do it

    Edit: to make it work as requested, added -r to remove quotes like Philippe suggested below