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

Have a dedicated semantic tag for JSON documents #5

Open pchampin opened 4 years ago

pchampin commented 4 years ago

Typically, a JSON-LD document is a JSON object, which naturally maps to a CBOR map.

But unlike JSON, CBOR allows non-strings as keys of a map. Since JSON-LD has a number of recurring keys (the keywords), space could be saved by conventionally encode these with a shorter type (a 1-bytes integer would be enough).

E.g., we could decide that 1 means @context, 2 means @type, etc.

In order to make this convention explicit, it would be cleaner to prefix this top-level map with a dedicated CBOR semantic tag.