0

The JSR of units of measurement 275 and 385 are rejected and not released, yet. However, they're the only sane way to work with units of measurement and dimensions, so I hope to get some insight into the following:

I'd like to serialize and deserialize a javax.measure.Dimension to and from a string to be used in JSON. I don't find any documentation or other information (most articles give an overview of the upcoming features and http://www.unitsofmeasurement.org/ redirects to http://ww17.unitsofmeasurement.org/ which is a blank page). The class names are not very explanatory for me (I searched for parse methods and similar approaches) and I don't find a Dimension class in JSR 385 reference implementation indriya. The only way I see for deserializing is to go through creation of a unit and to parse with AbstractUnit.parse(value).getDimension() which doesn't work the other way around.

The Jackson module jackson-module-unitsofmeasure 1.3.0 only seems to serialize Units.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177

1 Answers1

0

The serialization of a javax.measure.Dimension can be reliably achieved by serializing it's base dimension map which I suggested as pull request to jackson-module-unitsofmeasure at https://github.com/unitsofmeasurement/jackson-module-unitsofmeasure/pull/15.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177