We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

WebApi Json Formatter

Thread ID:

Created:

Updated:

Platform:

Replies:

130383 May 10,2017 10:50 AM UTC May 11,2017 04:39 AM UTC JavaScript 1
loading
Tags: ejReportViewer
gabriel
Asked On May 10, 2017 10:50 AM UTC

Hello, i have a web api service with the CamelCasePropertyNamesContractResolver as contract resolver and the report viewer is not working, if i change this to DefaultContractResolver, the report viewer works.
there is any way to make it work with the camel case?

Thanks

Yuvaraj Devarajan [Syncfusion]
Replied On May 11, 2017 04:39 AM UTC

Hi Gabriel, 

Thanks for contacting Syncfusion support.  

Currently we don’t have option to use camelCase for ReportViewer control. Since we have used the Pascal Case property for the resulted JSON value in WebAPI controller to process the report from server side. So We cannot able to decorate the camelCase JSON data to PascalCase format in IReportController. Instead of configuring the camelCase globally in Global.asax.cs file, we request you to create a “CamelCaseControllerConfigAttribute” class to decorate the camelCase for the required API classes using “CamelCaseControllerConfig” attribute as shown in below code example.   
 
public class CamelCaseControllerConfigAttribute : AttributeIControllerConfiguration  
    {  
        public void Initialize(HttpControllerSettings controllerSettings,HttpControllerDescriptor controllerDescriptor)  
        {  
            var formatter = controllerSettings.Formatters.OfType<JsonMediaTypeFormatter>().Single();  
            controllerSettings.Formatters.Remove(formatter);  
  
            formatter = new JsonMediaTypeFormatter  
            {  
                SerializerSettings = { ContractResolver = newCamelCasePropertyNamesContractResolver() }  
            };  
  
            controllerSettings.Formatters.Add(formatter);  
  
        }  
    }  
  
    [CamelCaseControllerConfig// Requried camalCase class  
    public class SomeController : ApiController  
    {  
       //Sample class  
    }  


Regards, 
Yuvaraj D. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;