Closed AlexSchoenfeld closed 1 year ago
Space is not allowed there.
@tcsaddul I can't change the incoming JSON since it's a 3rd party API we are consuming. Shouldn't it be mapped correctly when we use JsonPropertyName?
But I think that's invalid in JSON specs and it is also invalid as a C# field name.
But I think that's invalid in JSON specs and it is also invalid as a C# field name.
When I throw it like this into JSONLint it says its valid JSON. Also, when I use JsonSerializer.Deserialize<> it works just fine.
I know that such properties won't work in C#, that's why I added the JsonPropertyName.
Maybe this will help. https://stackoverflow.com/questions/32487483/javascriptserializer-custom-property-name
@AlexSchoenfeld JsonPropertyName
is from .NET's System.Text.Json library. Flurl (3.x and earlier) uses Newtonsoft. Switch to the Newtonsoft equivalent attribute and it should work:
https://www.newtonsoft.com/json/help/html/jsonpropertyname.htm
@AlexSchoenfeld
JsonPropertyName
is from .NET's System.Text.Json library. Flurl (3.x and earlier) uses Newtonsoft. Switch to the Newtonsoft equivalent attribute and it should work:https://www.newtonsoft.com/json/help/html/jsonpropertyname.htm
With the Newtonsoft Attribute JsonProperty it now works, thanks! 👍
Hi,
I have an issue when I'm receiving a JSON with property names that contain space characters:
Here are the classes with
JsonPropertyName
set for the names with spaces:As you can see here, MyRequest is always null:
My only workaround at the moment is to get it as string and then manually do it like this: