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 to Collection for...
Power Apps
Unanswered

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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard