Newtonsoft.Json icon indicating copy to clipboard operation
Newtonsoft.Json copied to clipboard

Support numbers as words in SnakeCaseNamingStrategy and KebabCaseNamingStrategy

Open mchandschuh opened this issue 5 years ago • 1 comments

Existing implementation does not treat numbers in any special way. They're treated most closely to lowercase characters. This change provides an options 'numbersAsWords' that permits viewing numbers as capable of starting and stopping a word.

Closes JamesNK/Newtonsoft.Json#2251

mchandschuh avatar Jan 02 '20 22:01 mchandschuh

As a note, the generated property names for things such as an ISO timestamp with this option enabled is straight up hideous :) -- I didn't make an attempt to make it look pretty, nor do I think it should be changed. As is, the property is explicit as to how it impacts member name generation and doesn't try to do anything fancy to prevent absurd results. Also, providing these cases via the tests provides tests as documentation so at least it's obvious as to what the expected behavior is, despite how unlikely someone would actually desire such an output.

mchandschuh avatar Jan 02 '20 22:01 mchandschuh