unitsofmeasurement / uom-lib

Units of Measurement Libraries
Other
14 stars 13 forks source link

Imperial POUND unit json field a bit off? #70

Closed csokol closed 3 years ago

csokol commented 3 years ago

Hi, running the following:

  public static void main(String[] args) throws JsonProcessingException {
    var om = new ObjectMapper();
    om.registerModule(new UnitJacksonModule());

    System.out.println(om.writeValueAsString(Quantities.getQuantity(10, Imperial.POUND)));
  }

Results in the following output:

{"unit":"(kg.45359237)/100000000","scale":"ABSOLUTE","value":10}

I'd say the "unit" value is a bit unexpected. Is that really correct?

keilw commented 3 years ago

Which version is that? Note, that even in 2.1 there is no Quantity Serializer yet, so it looks reasonable, for the Unit itself it should work after 2.1

csokol commented 3 years ago

Ah, sorry, forgot to report the version. I was using 2.1 and assumed it was the latest. Thanks!

keilw commented 3 years ago

It is, but at least Quantity Serialization would be subject to a new one.