looks like the JSON definition is not complete/valid - I'm comparing to this working sample: https://github.com/Azure/Community-Policy/blob/master/Policies/Tags/enforce-casing-on-tags/resource-groups-and-subscriptions/azurepolicy.json
can you try updating your JSON definition's "then" block should look like the below snippet?
"then": {
"effect": "modify",
"details": {
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/4a9ae827-6dc8-4573-8ac7-8239d42aa03f"
],
"operations": [
{
"operation": "addOrReplace",
"field": "tags",
"value": "[json(if(equals(parameters('toLowerOrToUpper'), 'Lowercase'), toLower(string(field('tags'))),toUpper(string(field('tags')))))]"
}
]
}
}