Hello everyone,
I' m trying to initialize a variable like shown on the screenshot but getting an error message
The variable 'vAuthorization' of type 'Array' cannot be initialized or updated with value of type 'String'. The variable 'vAuthorization' only supports values of types 'Array'. I'm a bit confuced by this error cause I have checked everything and array format should be fine. Please advise!
[
{
"Postion": "Applicant",
"Name": "@{triggerOutputs()?['body/Author/DisplayName']}",
"Status": "Submitted",
"Date": "@{formatDateTime(triggerOutputs()?['body/Created'], 'yyyy-MM-dd')}",
"Signature": ""
},
{
"Postion": "MNG",
"Name": "@{triggerOutputs()?['body/General_x0020_Manager/DisplayName']}",
"Status": "@{outputs('Get_item')?['body/General_x0020_Manager_x0020_appr/Value']}",
"Date": "",
"Signature": ""
},
{
"Postion": "DGM",
"Name": "@{triggerOutputs()?['body/Deputy_x0020_General_x0020_Manag/DisplayName']}",
"Status": "@{outputs('Get_item')?['body/DGM_x0020_approval/Value']}",
"Date": "",
"Signature": ""
},
{
"Postion": "GM",
"Name": "@{triggerOutputs()?['body/Manager/DisplayName']}",
"Status": "@{outputs('Get_item')?['body/Manager_x0020_approval/Value']}",
"Date": "",
"Signature": ""
},
{
"Postion": "Chief Accountant/FD Asst Manager",
"Name": "@{triggerOutputs()?['body/Chief_x0020_Accountant/DisplayName']}",
"Status": "@{triggerOutputs()?['body/Chief_x0020_Accountant_x0020_app/Value']}",
"Date": "",
"Signature": ""
},
{
"Postion": "FD Deputy GM",
"Name": "@{triggerOutputs()?['body/FD_x0020_Deputy_x0020_GM/DisplayName']}",
"Status": "@{outputs('Get_item')?['body/FD_x0020_Deputy_x0020_GM_x0020_a/Value']}",
"Date": "",
"Signature": ""
},
{
"Postion": "GD",
"Name": "@{triggerOutputs()?['body/General_x0020_Director0/DisplayName']}",
"Status": "@{outputs('Get_item')?['body/General_x0020_Director/Value']}",
"Date": "",
"Signature": ""
}
]
There is an error in the JSON. Therefore it is a String.
Remove the last comma from the value of the variable.
I am trying to set some variables as a .csv table which i will use later, but this flow is failing with the error stated in one of the screenshots.
@VictorIvanidze I have the same issue; I have attached my Initialize variable in edit mode.
Could you please take a look ?
My goodness, truly a pro tip. I spent over an hour trying to figure out why my Array wouldnt take my values - turns out there was a pre-emptive line break that was hidden! Thank you.
posting my solution here... problem was Microsoft Word and it's fancy fonts. I had an excel with 150+ rows. Copy/paste-as-text'd this to Word to use it's find/replace feature to swap out special character (paragraph) to:
",^l"
that changed the unprintable paragraph marks (from excel) to quote comma new-line quote .. that gave me the basic structure, just needed to add [ and ] at the beginning and end. Got the exact same error as you. and the quote marks look identical.... ...
Then I went to my favourite app for this kinda thing. Notepad. Pasted the array and the quotes were the stupid left/right 66 and 99 icons. I did a find replace in notepad for actual double-quote marks " (unicode: ALT-34)
Copy/pasted everything back in to the powerautomate initialize array function and voila. Green checkbox.
Someone else in the thread asked "are you sure it was the right type of quotes"... so i guess that was the same as i'm saying:
Curly-quotes “” and double-quotes " are NOT the same
Thanks for sharing that!! How many people wasted a lot of time trying to figure it out when all along, all it required was the typical WORKAROUND/HACK when as you said it should work as expected.
I wonder if it had something to do with it not being a Tuesday with a full moon??
Just because I had this issue today and found this post, I thought I'd share my solution in case it helps someone else in the same boat.
For me, this was just a matter of Power Automate being finicky. I had an "Initialize variable" action originally set to a string type, but later I changed it to an array type without changing the value and began receiving the OP's error. To resolve the error, I did this:
At this point, both actions were successful. I was able to change the name of my original variable back to what it was and remove the second action, and it continued to work after this. I guess Power Automate just needed a small bonk to the noggin to work as expected.
Build the dynamic json string in a variable (firstVarWithJsonString), and make that variable a string.
In the next variable, the one that is set as type "array" you can use this expression.
json(variables('firstVarWithJsonString'))
This is the missing part. This finally worked for me. Its very selective, but it does make sense, you convert the string, into JSON (even when the string looked like json, but Logic App does not know this) you have to convert the string to a json object, then the "array" type works.
Pstork1
20
Most Valuable Professional
rpersad
16
Michael E. Gernaey
12
Super User 2025 Season 1