Mapping JSON to CBOR #8
Labels
data mapping
discussions on data mapping concepts
Has Use Case Potential
The use case can be extracted and explained
Selected for Use Case
Many target protocols will use CBOR for payload data; an example is OCF. The current proposal uses JSON for the payload template and will depend on an automatic conversion to CBOR.
However, the CBOR definition (https://tools.ietf.org/html/rfc7049) includes the following text, emphasis mine:
In other words, a CBOR decoder does not need to support all CBOR features. This can lead to some issues when using general conversion from JSON, since specific JSON values can map to several different CBOR data types, depending on range and precision requirements. For example, suppose a particular decoder assumes that all floating-point numbers are 32-bit (single precision) and does not support other floating-point formats in the CBOR specification, such as 16-bit (half precision) floats. A general encoder might choose to use such a format unsupported by a target decoder for a given element of data given no other constraints.
Other features of CBOR that might not be supported on all devices are streaming string data (due to memory limitations) and specific number representations, such as bignums or 64-bit integers.
One possible resolution to the above situation would be to add some global options to the encoder to disallow certain CBOR features to ensure compatibility with the target device. These can be global options, rather than options on specific data items, since they arise from limitations of the CBOR encoder itself.
The text was updated successfully, but these errors were encountered: