You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have BigDecimal converters in the reboot version of json4s-ast. There is an argument that this should be separate from the json4s-ast, however there are also strong arguments for why it should be included, which are
Verifies correctness of the construction of the BigDecimal inside JNumber. As an example, a common rookie mistake is to do something like JNumber(BigDecimal(3434f)), where as, what you should do is something like JNumber(BigDecimal.decimal(3434f)). That method doesn't even exist in Scala 2.10, hence why the reason behind https://github.com/mdedetrich/json4s-ast/blob/reboot/jvm/src/main/scala/org/json4s/JValue.scala#L20
Mandate a standard format for JNumber, which can help in serialization/portability between different libraries that use json4s-ast. Although not currently implemented, having a converter for something like BigDecimal to Array[Byte] does make some sense in establishing a format
Provide convenience methods for really common use cases, i.e. going from BigDecimal to Int when used for things like ids
Can provide performance improvements due to our aggressive use of @inline (see reboot - use of @inline #2)
We currently have
BigDecimalconverters in the reboot version ofjson4s-ast. There is an argument that this should be separate from thejson4s-ast, however there are also strong arguments for why it should be included, which areBigDecimalinsideJNumber. As an example, a common rookie mistake is to do something likeJNumber(BigDecimal(3434f)), where as, what you should do is something likeJNumber(BigDecimal.decimal(3434f)). That method doesn't even exist inScala 2.10, hence why the reason behind https://github.com/mdedetrich/json4s-ast/blob/reboot/jvm/src/main/scala/org/json4s/JValue.scala#L20JNumber, which can help in serialization/portability between different libraries that usejson4s-ast. Although not currently implemented, having a converter for something likeBigDecimaltoArray[Byte]does make some sense in establishing a formatBigDecimaltoIntwhen used for things like ids@inline(see reboot - use of @inline #2)