w3c / json-ld-cbor

JSON-LD 1.1 in CBOR Note
https://w3c.github.io/json-ld-cbor/
Other
7 stars 6 forks source link

Management of datatype-aware encodings #2

Open vcharpenay opened 4 years ago

vcharpenay commented 4 years ago

CBOR has a range of datatypes that subsumes that of JSON. Datatype declarations in a JSON-LD context can be leveraged to optimize serialization of typed literals.

vcharpenay commented 4 years ago

Example:

{
  "@value": "2019-01-17T10:38:33Z",
  "@type": "xsd:dateTime"
}

would be encoded as a CBOR map with 2 key/value pairs while it could also be encoded as the positive integer 1579257513 tagged item with semantic tag 1 (POSIX timestamp).