Closed tchristian32 closed 5 years ago
Hehe! an interesting side effect of the Helper.AutoConv()
and the Helper.CreateInteger(string,...)
methods.
It is possible to add a config to enable/disable auto converting, and in your case if disabled you would get an error [which I presume is what you want].
Yes that is what I want in this situation. How can I disable auto converting? Thanks!
try v2.2.1
I have added JSONParameters.AutoConvertStringToNumbers
Thanks! Pulling that down now
We have an object that has an int as a property:
public class SomeData { public int UserId; }
If I pass data like this:
{ "UserId" : "G" }
JSON.ToObject<SomeData>(payload)
will convert the G into an int, 23 I believe. This also happens if I pass "AG" or even "'" (a single quote).This means that if someone passes G or something else to my API, I will happily convert it to some random number and then try to act on that User (assuming I have that ID in my system). Is there a way to either disable that conversion or control it in some way?