This is the code block that is failing when I call CreateOrUpdateAsync. The Logic App runs just fine in Azure, but when I try to create it using the .NET SDK I get JSON parsing issues.
'foreach': '@variables(""LocationData"")',
'runAfter': {
'Initialize_variable_2': [
'Succeeded'
]
}
Here is the error message.
{"The template validation failed: 'The template action 'For_each' at line '1' and column '263' is not valid: \"The template language expression 'variables(\"LocationData\")' is not valid: the string character '\"' at position '10' is not expected.\".'."}
If I change to single quote, I get this error.
'foreach': '@variables('LocationData')',
'runAfter': {
'Initialize_variable_2': [
'Succeeded'
]
}
{"After parsing a value an unexpected character was encountered: L. Path 'actions.For_each.foreach', line 651, position 40."}
This JSON formatter & validator doesn't like it either.
https://jsonformatter.curiousconcept.com/
Does anyone know the problem and how to fix it?
Any help is much appreciated! Thanks!
I went ahead and created my own Classes to handle the workflow definition.
Here is a sample. It was a lot of code, but it works great.
I even wrote Classes to handle my ParseJson Actions. Here is a sample.
I then called it like so.
Finally, I created the workflow definition JSON string. This is an ASP.Net Core app.
I used this method to add a $ to the first occurrence of the word schema.