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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / JSON function giving b...
Power Apps
Unanswered

JSON function giving behavior function in non behaviour property

(0) ShareShare
ReportReport
Posted on by 1,246

Hi, I'm trying to use JSON to convert a Powerapps colour into a hex value. It works if I put the code on a button and set a variable, but for some reason it's giving me an error if I try and put this directly into a text label. 

 

Is this something particular to the JSON function? 

 

Works on a button:

ChrisD_0-1695894998832.png

 

Error in text label:

ChrisD_1-1695895044085.png

 

 

EDIT:
Wrapping in a With() didn't work.

 

Categories:
I have the same question (0)
  • Verified answer
    tareqrosul Profile Picture
    164 on at

    Hello @Chris-D 

    The issue you're experiencing is rooted in how PowerApps differentiates between "behavior functions" and "non-behavior properties."

    In PowerApps, certain functions are classified as "behavior functions." These functions are meant to execute specific actions or side effects, rather than just returning a value. The JSON() function is one of these behavioral functions. It's primarily designed for actions like converting records or tables to a JSON format rather than being used for direct display.

    The OnSelect property of a button is a behavioral property, designed to react to user actions. So, when you use the JSON() function within a button's OnSelect property, it works as expected.
    However, the Text property of a label is a non-behavior property, which simply binds and displays data. When you attempt to use a behavior function like JSON() directly within a non-behavior property, PowerApps gives an error or doesn't display the desired output.


    The recommended workaround for this situation is using this function within within a button or another behavioral property to set a variable. Then, bind this variable to the Text property of your label.Which you already did.

     

    I hope this clarifies the distinction between behavior functions and non-behavior properties in PowerApps. Let me know if you have any further questions!

    If my response was beneficial to you, feel free to leave a 👍 symbol. If it effectively resolved your query, please signify with a 👍 and mark it as the Solution, assisting other community members in locating this helpful information more readily.

     

  • Chris-D Profile Picture
    1,246 on at

    Thanks for the explanation.

     

    I have experienced non behaviour functions before, like UpdateContext() and understand that they change the state of things. I can't imagine what JSON() is changing, thought it just returned text.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard