jsonld.js
jsonld.js copied to clipboard
Forward slash in JSON key treated as error
A forward slash in JSON key like this:
{
"@context": {
"@version": 1.1,
"a/b": "https://a"
}
}
is treated as bad syntax: jsonld.SyntaxError: Invalid JSON-LD syntax; term in form of IRI must expand to definition.
However, forward slash is perfectly valid in JSON.
Where does this syntax error come from?
{
"@context": {
"@version": 1.1,
"a_b": "https://a"
}
}
is OK.
However, Apache Jena riot also reports this as invalid:
ERROR org.apache.jena.riot - A local context contains a term that has an invalid or missing IRI mapping [code=INVALID_IRI_MAPPING].
when used like this:
{
"@context": {
"@version": 1.1,
"a/b": "https://a"
},
"@id": "https://id",
"a/b": 2
}
@jakubklimek your issue is not too far from the one I was having here: https://github.com/digitalbazaar/jsonld.js/issues/542. Maybe it can help