API is returning re...
 
Notifications
Clear all

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

2 Posts
2 Users
0 Likes
102 Views
Angela Hudson
Posts: 1
Topic starter
(@angela-hudson)
New Member
Joined: 1 month 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
Dotnet Report
Posts: 28
Admin
(@admin)
Member
Joined: 10 months 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: