web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot initialize JSON...
Power Automate
Suggested Answer

Cannot initialize JSON object with initialize variable

(1) ShareShare
ReportReport
Posted on by 26
My power app button passes one json object among 6 texts, and I wanted to initialize this in power automate. In the power App V2 trigger, I created a text input called varOptionalFields.
I then proceeded to add a initialize variable with the code: 
json(triggerBody()?['varOptionalFields'])
Now when running the power App, the json object does get outputed by the power apps trigger as seen by:
{"Beschreibung_2":"test","Beschreibung_3":"tet","Beschreibung_4":"tes","Beschreibung_5":"test","Beschreibung_6":"test","Beschreibung_7":"test"}
But the initialize variable fails and i get this error message:
 
Action 'Initialize_variable' failed: Unable to process template language expressions in action 'Initialize_variable' inputs at line '0' and column '0': 'The template language function 'json' expects its parameter to be a string or an XML. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#json for usage details.'.
 
 
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    When you pass a JSON value in the trigger it comes in as text.  You need to use a Parse JSON action in Power Automate to turn it back into valid JSON with a schema.  I do this frequently when passing large numbers of parameters.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    Make it null-safe
    Use:
    • json(coalesce(triggerBody()?['varOptionalFields'], '{}'))
    Ensure Power Apps sends JSON as STRING
    Use:
    • JSON(varOptionalFields, JSONFormat.Compact)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard