Open
Description
The spec doesn't describe explicitly enough what happens with JSON builtin types integer
and double
.
- https://w3c.github.io/json-ld-syntax/#typed-values talks about 64-bit doubles and says "such as" without being exhaustive
- By using a native JSON type such as number, true, or false.
- https://w3c.github.io/json-ld-syntax/#type-coercion talks about converting strings, not numerics
- Type Coercion / Node Conversion: @coerce keyword or similar #335 describes an unpleasant situation where an integer (eg
3
instead of"3"
) cannot be used in URL - this example at the playground produces
ex:pi "3.14E0"^^xsd:double
(ok) butex:two "2"^^xsd:integer
?!?!?
{"@context":{"@vocab":"http://example.org/"},
"pi": 3.14, "two": 2.0000000000000001}
- remove one decimal zero and you get
ex:two "2.000000000000001E0"^^xsd:double
which means the datatype varies with the lexical precision - In contrast, Turtle is consistent:
2.0
and2.0000000000000001
meanxsd:decimal
@msporny @gkellogg
I think the spec should be more explicit what implicit conversions are applied to JSON builtin types, and give some warnings about the examples above.
Metadata
Metadata
Assignees
Type
Projects
Status
Errata