I'm trying to use jq to parse JSON that looks something like:
{
"username": "billy",
"hero": {
"something": "goeshere"
},
"bumper": {
"bumper2": {
"bumper3": "splodge"
}
},
"morgan": [{
"abc": 123
}, 2, 4, {
"def": 567
}],
"password": "issilly"
}
into
request.username == 'billy' && request.hero.something == 'goeshere' && request.bumper.bumper2.bumper3 == 'splodge' && request.morgan[0].abc == 123 && request.morgan[1] == 2 && request.morgan[2] == 4 && request.morgan[3].def == 567 && request.password == 'issilly'
So far I've got to
jq '. | to_entries[] | "request.\(.key) == '\(.value)'"'
which gets me part of the way there, but I can't work out how to "walk down" into the deep-nested elements, nor how to join the strings produced into a single line delimited with ' && '