web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Problem handling Powerapps Custom Connector response - "JSON parsing error, expected 'object' but got 'string'"

(0) ShareShare
ReportReport
Posted on by 10
I have created a custom connector to make a post request to our REST Service that returns an array of objects nested in another object. My goal is to work with object.Data.Data.
{
    "User": "55205bb2-28c4-ed11-83ff-0022489ede2f",
    "ErrorMessage": null,
    "Data": "{\"TotalRecordCount\":1,\"TotalRecordExcluded\":0,\"Data\":[{\"Id\":\"13a0293d-c7de-ed11-a7c6-0022489ede2f\",\"Name\":\"Second trial!\",\"FileName\":\"Another File Name\",\"TotalRows\":14,\"IsProcessed\":false,\"Date\":\"2023-04-17T22:00:00Z\",\"ExpectedFileDate\":\"2023-04-03T22:00:00Z\",\"IsCompleted\":false,\"ErrorMessages\":null,\"Excluded\":false,\"LogicalName\":\"eps_datacollectionfile\"}]}"
}

This is the method in the service called:

try
            {
                Log.Debug($@"X-Correlation-ID {CorrelationId} - START: GetMultipleFileInfo- ids {ids}");
                List<MsdDataCollectionFile> fileinfo = GetMultipleFileInfoData(ids);
                dynamic paged = new ExpandoObject();
                paged.TotalRecordCount = fileinfo.Count;
                paged.TotalRecordExcluded = fileinfo.Where(x => x.Excluded).Count();
                paged.Data = fileinfo;
                Log.Debug($@"X-Correlation-ID {CorrelationId} - END: GetMultipleFileInfoData- totalrecord {fileinfo.Count}");
                return new HttpResponse(((System.Dynamic.ExpandoObject)paged).ToJSON(), null);
            }

I call it in a custom app creating a collection passing the parameters it expects (with

ClearCollect(connectorCollection, DataCollection.GetFile(userId, "application/json", {body:"13a0293d-c7de-ed11-a7c6-0022489ede2f"}).Data.Data))

It seems ok because the gallery in Canva gets the data model correctly.

pastedimage1682600689962v2.png

However, when launched from the model-driven app, it doesn't work, saying, "JSON parsing error, expected 'object' but got 'string'."

pastedimage1682600702644v3.png

pastedimage1682600721077v4.png

Does anyone of you know what I can fix in the parsing?

I was trying to fetch an object from a Canvas App through a Custom Connector and expecting to be able to read the object.

I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans