"/" escaped for URLs in ~JSON-LD?


I’m looking at the API and am seeing that ‘/’ is escaped to ‘\/’ in its output. Is that a feature or a bug?

For example:

Could well be a feature. If yes, is that the only character that’s escaped? I haven’t found an example of a more complex URL (with ‘&’,’?’ and other reserved characters).

It does look like the API is emitting something similar to JSON-LD. But then the '/'s shouldn’t be escaped?

I’m keeping this email brief. Could be a can of worms. Or response could be, “That’s how we do it.”. I’ll deal with the latter if that’s the case.


Your message is slightly confusing, I imagine because the forum software itself is interpreting your escaped-slash \/ example in your post, so both look the same.

Forward slashes are indeed escaped in the JSON-LD output, it’s a PHP JSON encoding default which is there to avoid security issues with rendering JSON in HTML.

The escaped slashes shouldn’t matter to any parser, whether plain-JSON or JSON-LD. Forward slashes are one of the characters that has a defined “short” escape sequence in JSON. Are they actually making a difference somewhere for you?

Thank you for catching that. Now fixed.

And… You’re right. Doesn’t matter. But… JSON-LD playground[1] isn’t parsing the output[2]. The error message there caused concern. Should have done more digging on my own. Will do and report… Perhaps via new topic.



[1] https://json-ld.org/playground/

[2] https://json-ld.org/playground/#startTab=tab-expanded&json-ld=http%3A%2F%2Fdev.omeka.org%2Fomeka-s-sandbox%2Fapi%2Fitems%3Fitem_set_id%3D2093

Looks like a CORS issue. I can fix that on my own server. Sorry to bother…