question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v10: De-serialization of Decimal fails when there is no leading zero

See original GitHub issue

Source/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:open
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
AlexisColescommented, Nov 22, 2017

Maybe we could have strict setting that we could set to false.

1reaction
TylerBrinkleycommented, Nov 21, 2017

I agree with you but that wasn’t my call.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found