Skip to main content

Notifications

Community site session details

Community site session details

Session Id : g7BNhm0z7n5AnGkyI0FGHb
Power Apps - Building Power Apps
Answered

JSON function giving behavior function in non behaviour property

Like (0) ShareShare
ReportReport
Posted on 28 Sep 2023 09:58:39 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.

 

  • Chris-D Profile Picture
    1,246 on 29 Sep 2023 at 11:26:58
    Re: JSON function giving behavior function in non behaviour property

    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.

  • Verified answer
    tareqrosul Profile Picture
    155 on 28 Sep 2023 at 18:14:34
    Re: JSON function giving behavior function in non behaviour property

    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.

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 32

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 19 Super User 2025 Season 1

#3
Rajkumar_M Profile Picture

Rajkumar_M 16 Super User 2025 Season 1

Overall leaderboard
Loading started