Type coercion to native JSON numbers via JSON-LD API?


is it possible to use JSON-LD API to coerce number-like strings into native
JSON numbers (http://www.w3.org/TR/json-ld/#dfn-number)? The section of the
specification on type coercion (http://www.w3.org/TR/json-ld/#type-coercion)
seems to suggest that this is possible, but so far I haven't realized how.

For example, is it possible to coerce the values of the "age" attribute to
numbers in the following JSON-LD?

  "@context": {
    "@vocab": "http://xmlns.com/foaf/0.1/",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "age": { "@type": "xsd:integer" }
  "age": "42"

Setting a numeric datatype (such as xsd:integer) for the property via @type
in @context doesn't do the job.

Is there a way to go about this?




Received on Thursday, 15 January 2015 16:56:47 UTC