unitsofmeasurement / indriya

JSR 385 - Reference Implementation
Other
122 stars 42 forks source link

How to serialize Quantities and Units? #203

Closed andi-huber closed 5 years ago

andi-huber commented 5 years ago

What is the current best practice to serialize instances of Quantity to XML or JSON?

I suppose there could or should be a specific Formatter to cover this use case.

I'm also curious whether such a serialization format should be well documented and part of the JSR 385, to allow for users to serialize (and parse) instances of Quantity in a way, that is independent of the implementing library.

keilw commented 5 years ago

For JSON this is covered in https://github.com/unitsofmeasurement/uom-lib/tree/master/jackson already. Where you think of QuantityFormat or UnitFormat implementations, they could go there, but this is not something for the RI itself, will close this here because it is out of scope, please raise a ticket in https://github.com/unitsofmeasurement/uom-lib/issues for things like XML support or other JSON libraries like the JSONB standard.

andi-huber commented 5 years ago

I was not aware of these extension projects. Thx for the pointers.