I'm writing the Schema.org JSON-LD for a website now. For a
url within my site, what will work / best practice?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
For Schema.org, JSON-LD, and conforming consumers, it doesn’t matter.
The relative form is shorter and doesn’t require changes if you change the domain. But if a consumer happens to access your document under a different URL, the URL values will be different, too.
The absolute form is what you’d use anyway for external links, and it helps making sure that consumers will always end up at the intended place. But it’s somewhat longer, and if you want to change the domain, you have to update your structured data.
Unfortunately I don't have enough reputation to add a comment to @unor's answer. I want to confirm that what he says is true with some evidence.
I had the same question and end up doing some research. The key part is this:
If you paste markup directly into google validator and there is a relative path - validator doesn't know which domain it belongs to and just appends its own domain (https://search.google.com). Once you deploy changes and test with real url you'll see that validator will append correct domain, so you can definitely use relative urls in structured data.