In this Power Apps Tutorial, I will show you how to fix an error, The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’ that comes while working with the Power Apps JSON function.
I recently had to use the JSON function when working with Power Apps to retrieve all the column names from the SharePoint list.
I got a nested property Attachments error when attempting to use the Power Apps JSON function.
The screenshot below represents the error that displays: The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’.
We’ll now go into more depth about this problem and how to fix it.
The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’ – Error
- Here, I have an Employee Onboarding SharePoint List. As shown below, this list includes several columns as well as records.
- ID, Employee Name, Employee Last Name, Employee ID, etc are my SharePoint list column names.
- Now, I wanted Power Apps to retrieve every SharePoint list column. I first created a Power Apps Collection and stored all the SharePoint list columns in it in order to satisfy this need. [I have written all the codes below on the Button’s OnSelect property]
ClearCollect(
colEmpOnboardingDetails,
'Employee Onboarding'
);
Where,
- colEmpOnboardingDetails = Collection Name
- ‘Employee Onboarding‘ = SharePoint List Name
- I then extracted all of the collection column headings using the code below, where I had to use the Power Apps JSON function.
Set(
varListColumnNames,
Distinct(
Ungroup(
MatchAll(
JSON(
colEmpOnboardingDetails,
JSONFormat.IgnoreBinaryData
),
"([^""]+?)""\s*:"
).SubMatches,
"SubMatches"
),
Value
)
)
Where,
- varListColumnNames = Variable name where the result will store
- colEmpOnboardingDetails = Collection name that you have created
- While I used the JSON function and added the collection name to it, I got an error like “The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’.“
- The error states clearly that the fields like Attachments of ‘Table(Attachment)’ cannot be serialized. It’s all fine because there is a JSON format value to include Unsupported kinds. But what does it mean exactly? After all, we have specified IgnoreBinaryData.
In the below section, we will see how we can fix this above issue in Power Apps JSON function.
The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’ – Solution
When I encountered this problem, I went some online research and looked at a variety of websites. But I found a workaround and applied it to the code. I subsequently found a solution to my issue and continued on as necessary.
But it’s only a tiny trick. You only need to use the “&” operator to combine two formats, and you can use as many as you wish. You must use the JSONFormat. IgnoreUnsupportedTypes function as well.
You can refer to the solution code below as well:
Set(
varListColumnNames,
Distinct(
Ungroup(
MatchAll(
JSON(
colEmpOnboardingDetails,
JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes
),
"([^""]+?)""\s*:"
).SubMatches,
"SubMatches"
),
Value
)
)
Where,
JSONFormat.IgnoreUnsupportedTypes = Unsupported data types are accepted, but they won’t be included in the final result.
Enter the formula above, then Save, Publish, and Test the app. And it now works flawlessly.
This is how we can solve the Power Apps JSON function error i.e. The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’.
Additionally, you may like some more Power Apps & Dataverse tutorials:
- How to get Collection Column Names in Power Apps [From 3 Different Datasources]
- The function Search has some invalid arguments in PowerApps
- You don’t have permission to view this data error in PowerApps
- Invalid Connection. Please Choose a Connection Power Automate
- How To Get Dataverse List Rows Count Using Power Automate
- How To Remove Commas From Dataverse Number Field
In this Power Apps Tutorial, We discussed how to solve the error, The JSON function cannot serialize tables / objects with a nested property called ‘{Attachments}’ of type ‘Table(Attachment)’ that comes while working with the Power Apps JSON function.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com