In order to track issues added to the sprint after sprint start, I am trying to set up an automation as follows: 
{
"update": {
"labels": [{
"add": {{issue.sprint.last.name.asJsonStringArray.replace(" ","-")}}
}]
}
}When the sprint is started, issues in that sprint are edited: they receive a label that is copied from the name of the current sprint.
Jira throws an error about the JSON. I have to use this because the 'Choose fields to set' does not allow me to add a new label on top of the existing ones.
On the screenshot above, it says 'The JSON is valid' but the audit log says 'Error while parsing additional fields. Not valid JSON.'
When I type:
{
"update": {
"labels": [{
"add": {{issue.sprint.last.name.asJsonStringArray.replace(" ","-")}}
}]
}
} it throws the error "The label 'TEST Sprint 10' can't contain spaces. (labels))" so I suspect it's the attempt to remove spaces that doesn't work.
Any help to make this work would be greatly appreciated.