View Issue Details

IDProjectCategoryView StatusLast Update
000894010000-006: MappingsSpecpublic2023-05-16 15:41
ReporterThilo Bellinger Assigned ToRandy Armstrong  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.05.01 
Fixed in Version1.05.03 RC1 
Summary0008940: unclear JSON encoding for Decimal in Variant
Description

The normal JSON encoding for Decimal (5.4.3) states to encode just the content of the decimal (Scale and Value), thus to omit the fields which make it look similar to an ExtensionObject (TypeId and Encoding).

The general rules for Decimal (5.1.8) state that when a Decimal is stored in a Variant, then the Variant TypeId should be set to ExtensionObject.

If both rules shall be followed strictly, then it is difficult to decode a Decimal from a Variant for JSON as the common identifier fields are missing.
Applications which don't support the DecimalType won't be able to treat it like an unknown ExtensionObject.

When used in a Variant, then I propose to store the Decimal content as the Body field of an ExtensionObject and use similar rules as for binary encoding.

  • Use the Decimal data type ID (50) in the TypeId field
  • Fill the Encoding field according to the allowed settings for JSON ExtensionObject (5.4.2.16) (0, 1 or 2 for Structure, ByteString or XmlElement body)
    or only option 0
  • fill the Body field according to the EncodingField
TagsNo tags attached.
Commit Version
Fix Due Date

Activities

Randy Armstrong

2023-05-12 05:40

administrator   ~0019331

Added:

When encoding in a Variant, a Decimal value shall be encoded as an ExtensionObject with the JSON object in Table 37 as the Body. The TypeId shall be the NodeId of the Decimal DataType and the Encoding shall be 0.

Jim Luth

2023-05-16 15:41

administrator   ~0019382

Agreed to changes in Web meeting.

Issue History

Date Modified Username Field Change
2023-05-05 17:30 Thilo Bellinger New Issue
2023-05-12 05:40 Randy Armstrong Assigned To => Randy Armstrong
2023-05-12 05:40 Randy Armstrong Status new => resolved
2023-05-12 05:40 Randy Armstrong Resolution open => fixed
2023-05-12 05:40 Randy Armstrong Fixed in Version => 1.05.03 RC1
2023-05-12 05:40 Randy Armstrong Note Added: 0019331
2023-05-16 15:41 Jim Luth Status resolved => closed
2023-05-16 15:41 Jim Luth Note Added: 0019382