Skip to content
API is returning re...
 
Notifications
Clear all

API is returning reportData.columns and client is expecting ReportData.Columns.

2 Posts
2 Users
0 Reactions
1,251 Views
Posts: 1
Topic starter
(@angela-hudson)
New Member
Joined: 2 years ago

Hi!

So the API seems to be sending down good data now, but i'm still seeing the same error as before on the client when I try to run a report.

I have attached a couple screenshots of what i'm seeing. I'm wondering if it's a casing issue?
API is returning reportData.columns and client is expecting ReportData.Columns.
Just a thought. Let me know if you need more info. Thanks!

 

image
image

Angela Hudson

Senior Software Engineer

 

image
image
image
1 Reply
Posts: 33
Admin
(@admin)
Member
Joined: 3 years ago

Hey Angela, ok great. Thanks for sending the details.

Yes, as you noted, this is because the service is sending data after automatically formatting it in "pascalCase" instead of letting it come back as is. We have actually seen this before in some cases. The fix is to apply "As is case naming" strategy.

So on the service side, you would have to add this in the ReportApiController:

internal class AsIsCaseNamingStrategy : NamingStrategy
{
protected override string ResolvePropertyName(string name)
{
return name;
}
}

And then change the return from "return Ok()" to:

//return Ok(model);
return new JsonResult(model, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver { NamingStrategy = new AsIsCaseNamingStrategy() } });

Basically this:

 

image

It should resolve to "Newtonsoft.Json.Serialization":

 

image

Let me know if this helps resolve the issue.

Thanks!

dotnet Report Team

Reply
Share:
Index
;