Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Snakeize should not modify key if the key is a negative number #495
json4s version 3.6
scala version 2.11
jdk version 8
When the key is a negative number, the negative(-) gets turned into an underscore (_). This test is an example:
To reproduce the error put the following test case in ParserBugs.scala and run it
you'll see the following error where the -1 is converted to _1
In Json4s, if you use snakizeKeys, it does not judge whether the key is a number or not, so it will be converted to a uniform underscore.
Since snakizeKeys is specified, it can only be judged by the user code whether conversion is acceptable or not, so I think it is better to use the transformField method to perform your own conversion.
Experience-wise, it's much more likely that a prepended
But that said, if the priority is to keep the code simple with as few judgements as possible, then you're right.