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 Apps / JSON to Collection for...
Power Apps
Answered

JSON to Collection for Choice/object column

(0) ShareShare
ReportReport
Posted on by 183

Hello,

 

I have this app where I store a collection to JSON with this format to be used by PowerAutomate : 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Categorie": {
 "type": "object",
 "properties": {
 "Value": {
 "type": "string"
 }
 }
 },
 "ID": {
 "type": "integer"
 },
 "PrixUnitaire": {
 "type": "integer"
 },
 "Quantite": {
 "type": "integer"
 },
 "Reference": {
 "type": "string"
 },
 "Titre": {
 "type": "string"
 }
 },
 "required": [
 "Categorie",
 "ID",
 "PrixUnitaire",
 "Quantite",
 "Reference",
 "Titre"
 ]
 }
}

"Categorie" is an object and specifically a Choice Column of a SharePoint List.

 

I then use this JSON in the same app to convert it back to the same collection for another usecase, but I can't figure out how to get the correct formula for the "Categorie" object.

 

Here is the code I use to collect the JSON, the other fields are collecting correctly, but I can't find the correct way to do it for "Categorie" :

 ClearCollect(
 colSpPanierCreationPoste;
 ForAll(
 Table(ParseJSON(ThisItem.PanierRaw));
 {
 ID: Value(Value.ID);
 Quantite: Value(Value.Quantite);
 Titre: Text(Value.Titre);
 OrdreTri: Value(Value.OrdreTri);
 Categorie: ???
 Reference: Text(Value.Reference);
 PrixUnitaire: Value(Value.PrixUnitaire);
 }
 )
)

 

Thank you 🙂

Categories:
I have the same question (0)
  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can try the expression below. The schema says that the value of 'Categorie' is a record (object), with a single text property called Value:

    ClearCollect(
     colSpPanierCreationPoste;
     ForAll(
     Table(ParseJSON(ThisItem.PanierRaw));
     {
     ID: Value(Value.ID);
     Quantite: Value(Value.Quantite);
     Titre: Text(Value.Titre);
     OrdreTri: Value(Value.OrdreTri);
     Categorie: Text(Value.Categorie.Value)
     Reference: Text(Value.Reference);
     PrixUnitaire: Value(Value.PrixUnitaire);
     }
     )
    )

    Hope this helps!

  • Verified answer
    Jedediah Profile Picture
    183 on at

    Unfortunately, this doesn't work but...

    You put me on the right track, since it's a record, I found the right syntax :

    ClearCollect(
     colSpPanierCreationPoste;
     ForAll(
     Table(ParseJSON(ThisItem.PanierRaw));
     {
     ID: Value(Value.ID);
     Quantite: Value(Value.Quantite);
     Titre: Text(Value.Titre);
     OrdreTri: Value(Value.OrdreTri);
     Categorie: {Value:Text(Value.Categorie.Value)};
     Reference: Text(Value.Reference);
     PrixUnitaire: Value(Value.PrixUnitaire);
     Illustration: LookUp(colSpCatalogue;ID=Value(Value.ID)).Illustration
     }
     )
    )

     

    Thank you very much 🙂

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard