jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

use the JSON primitive types for Boolean, Integer, Number in compaction output

Open fennibay opened this issue 1 year ago • 0 comments

Currently JSON-LD compaction always outputs the values as strings, even when the @type is specified to be a primitive type such as xsd:boolean, xsd:integer and xsd:double.

It would be nicer for JSON parsers that such values would be available as native JSON Booleans, Integers and Numbers.

Basically I'm proposing to introduce a useNative flag in compaction options, similar to fromRdf and Normalize.

See also:

  • #462
  • https://github.com/json-ld/json-ld.org/issues/100
  • https://github.com/json-ld/json-ld.org/issues/150

edit: removed Null from the proposal, that doesn't have a corresponding xsd type.

fennibay avatar Jun 17 '24 16:06 fennibay