Open beclever opened 4 years ago
Since JsonNumber class's access right is the same package, even Json is a non-final class, I can't solve this problem.
Can yu solve this by creating your own writer? PrettyPrint might show some pointers as to how:
Since JsonWriter
class's access right is the same package, I can't extends it, then I can't create my writer extends WriteConfig
, and the JsonArray.toString() or the JsonObject.toString() need the WriteConfig as parameters...
is it possible to make some key/common classes'access right to make them more extensible and configurable
I have a requirement that If the float(double) value has an exponent, the "e" MUST be in lower case. in our case,when serializing a JsonObject as a String, For example,
Because of the internal call to
Json.value(value)
, thenDouble.toString(value)
, this becomes2.1474836471E10
Since Json is a final class, there are no extensible way to override methods. If we provide an extension, such as my extension class Enhancejson.value method, which I can implement with
Double.toString(value).toLowerCase()
.My question is, if we can change Json to a non-final class, or is there a better way to solve this problem?
if no workaround, I'll consider to make a Pull Request. Thank you very much.