v10: De-serialization of Decimal fails when there is no leading zero
See original GitHub issueSource/destination types
Source: string
Dest: Decimal
Source/destination JSON
source: ".1"
dest: 0.1
Expected behavior
Expect num = 0.1
Actual behavior
Newtonsoft.Json.JsonReaderException: Input string ‘.1’ is not a valid decimal
Steps to reproduce
var num = JsonConvert.DeserializeObject(".1", typeof(Decimal));
Works fine with v9 but fails in v10.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Override Json deserializing a number with a leading zero ...
Indeed this is invalid JSON. The JSON spec says that leading zeros are not allowed. It is a bug in your generator if...
Read more >Bring back leading zero for decimal literals (not for octal ...
I couldn't believe it when I first encountered this: val i = 01 //Error: Decimal integer literals may not have a leading zero....
Read more >Remove leading zero and trailing decimal from display of ...
I would like to keep all those options (specifying the significance and number of decimals, preventing exponential notation, and ignoring string ...
Read more >CyberChef
The Cyber Swiss Army Knife - a web app for encryption, encoding, compression and data analysis.
Read more >URL | Node.js v20.5.1 Documentation
In cases where it is not known in advance if input is an absolute URL and a base ... Leading numbers up to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe we could have strict setting that we could set to false.
I agree with you but that wasn’t my call.