I have a short jq filter that works fine:
cat data.tmp2 | ./jq-linux64-1.5 -r '.issues[].fields.customfield_10025 | if .value != null then (.value + "," + .child.value ) else "" end'
It produces exactly what I need, if the field is empty, it returns "", if the field is not empty, it uses the field value and combines the comma and child value. However, when I move my filter in the larger filter shown below, I get an error: Cannot index a row with the string "value"
This is a longer filter that fails:
cat data.tmp2 | ./jq-linux64-1.5 -r '.issues | map([.key,.fields.project.name,.fields.parent.key,.fields.issuetype.name,.fields.status.name,.fields.priority.name,.fields.resolution.name,.fields.assignee.name,.fields.reporter.name,.fields.created,.fields.updated,.fields.resolutiondate,.fields.summary,(.fields.components | (map(.name?) | join (","))),(.fields.fixVersions | (map(.name?) | join (","))),.fields.customfield_10025 | if .value != null then (.value + "," + .child.value ) else "" end,.fields.customfield_10201] | join ("---"))
source
share