Currently, the unit property is documented with an example as:
... It takes the form of an object where category ID is the key and the value is an object.
Four properties of this object are currently closed: decimals, label, symbol and position.
Following the previous example, a client could display a value of 10 of metric exp as “$10.0 millions”.
If think the example is confusing because in one case the category id "pop" is used and in the other one "exp" is used as the key. Also the multiplier property is missing:
I think it would be useful to have a full, real-world example for the recommended use of the unit including parent label (which should not repeat the unit label):"label": {"exp": "exports"},"unit": {"exp": {"label": "million","decimals": 1,"symbol" : "m³","position" : "end"}"extension": {"multiplier": 6,"base" "m",}}full label example --> "exports 6,1 million m³"Note: Not sure about the placement of the different parts. Position refers to the symbol, but what about the positioning of the unit label property?
On Sunday, June 25, 2023 at 7:17:38 PM UTC+2 xavier wrote:
Hi Simon,You are absolutely right: the spec used two completely different examples in the "unit" section. I changed it to always refer to "exp" (exports).The example focuses on the "closed" properties: that's why "multiplier" is not present.It's a pity that the "unit" section is so "open". The problem comes from the first release of JSON-stat where this section was just a discussion section (it dealt with properties that could be useful to consider to describe the unit), and unfortunately has partially remained so. In the first release of JSON-stat, "extension" didn't exist, so it wasn't possible to leave these "suggestions" to an extension. As a consequence, some early JSON-stat adopters have been using some of the suggestions of the first release (for example, "base") that haven't ended up in JSON-stat v.2.0 as a "closed" property: the reason why they weren't removed from the spec altogether is because they appeared as a suggestion in the first release and they already had adopters.If I had to re-write from scratch the spec, it would only mention decimals, label, symbol and position and would suggest the possibility of enriching the metric information with an extension.X.