'Web API whitespace parameter value being converted to null

I have a simple web API service. There are about 10 different GET actions and these return a JSON output of various database records based on the input parameters.

For one particular endpoint a single space, ' ' should be a valid argument but this is being converted to null. Is there a way around this?

For example the URL is: http://localhost:1234/DataAccess/RetrieveProductData?parameterOne=null&parameterTwo=574&problemParameter=%20&parameterThree=AB12

Within the controller action I can see the following:

int? parameterOne => null
string parameterTwo => "574"
string problemParameter => null
string parameterThree => "AB12"

Is there any way to actually get:

string problemParameter => " "

Or is this not possible?



Solution 1:[1]

You should do it in the client app. Do you want to deserialize it on Android?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nima Owji