I'm having an issue with my asp.net REST API that I've created. The JSON string that is returned from a Get request has these trailing whitespaces shown below.
While doing webserches I found this link (Remove trailing spaces from Web API JSON) which shows a solution for removing the trailing whitespaces. The issue is that the link doesn't indicate what files (in the Visual Studio asp.net solution) needed to be modified. I need some help with that, since I'm quite noob-ish at this. Does this fix go into the Global.asax file? If not, where should it go? Is there any other change that I should consider instead of the provided link?
- I'm not using any custom JSON serializers. I'm using the one that comes stock when you create an asp.net solution in Visual Studio
- I created this project from a blank asp.net solution (but checked the "Web API" checkbox in the "New ASP.NET Project" dialog box.
- The provided link shows the solution for a MVC API. I'm not using MVC
What I've got:
{"ID":8,"Site":"EstevanPointCanada","PressureReading":"30.15 ","PressureTrend":"0 "}
What I want:
{"ID":8,"Site":"EstevanPointCanada","PressureReading":"30.15","PressureTrend":"0"}
Any assistance provided would be greatly appreciated.