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 / User defined types in ...
Power Apps
Suggested Answer

User defined types in Custom Pages

(0) ShareShare
ReportReport
Posted on by
I am currently testing this cool new feature. As far as I can see it seems to be not fully implemented for Custom Pages. For example type declaration using the := operator result in an error. 
 
MyType := Type({Items: [{Id: Number}]});

Using the Type() function with ParseJSON directly works quite well. Yet I am having trouble deserializing arrays of primitive types. Here's my example:

Set(TestArray, ParseJSON("{ ""Ids"": [1,2,3] }", Type({Ids: [Number]})));
 
This throws the following error: "JSON parsing error, expected 'object' but got 'number'."
 
Seems like my type declaration isn't correct even though it is accepted in the code window. Arrays of complex types work well though:
 
Set(TestArray, ParseJSON("{ ""Items"": [{""Id"": 1},{""Id"":2},{""Id"":3}] }", Type({Items: [{Id: Number}]})));
 
Is there anything I can do about the primitive typed array and will this feature be available for production anytime soon?
Categories:
I have the same question (0)
  • Suggested answer
    CarlosFigueira Profile Picture
    on at
    Currently, arrays of primitive values (or of other arrays) are not supported in the typed version of the ParseJSON function - only arrays of objects (like you showed in your second example) is supported at this point.
     
    As far as support for that, there are plans to support arrays of things other than objects, but we don't have any timeline at this point.
     
    Please consider creating a feature request at https://aka.ms/powerapps-ideas to add the support for that. The more upvotes it gets, the easier it is to increase its priority compared to other features we have.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard