A new JSON-LD tool: caveat emptor
As reported by +Barry Schwartz
, +Joe Hall
has released a JSON-LD generator for some schema.org
Nice to see, but users should be aware that there are some errors and limitations in the tool as currently implemented.Type casing
In a couple of cases the type is declared using a lowercase value. As schema.org
types and properties are case-sensitive, this is incorrect: schema.org/Product
The SDTT is forgiving about this, but it is an error (as you'll see if you run the code through the Linter - http://bit.ly/A6Kzgz
). Classes I've identified with this error:
@context is declared as www.schema.org
. This causes an unnecessary 301 to schema.org
, and may break the code for some processors (JSON-LD Playground, for example, returns an error).LocalBusiness requires a sub-type
Where, of course, you can simply use LocalBusiness if there's no appropriate sub-type.LocalBusiness uses "extra URL"
There's the utility to produce an "extra URL" for a LocalBusiness type. Adding such a URL produces an array of sameAs declarations (also available in organization).
url and sameAs are different animals, however. A webmaster might
end up using this correctly, or might not.
"name": "My Shelter",
The input instructions say "Image (relative or absolute url)". You positively can't use a relative URL here. There may be situations where this is possible in JSON-LD, depending on the processor and the precise code being deployed (though IMO you should always - as recently discussed here - use an absolute URL), but certainly not
here because there's no URL declared that this is relative to.Product ratings
Rating assumes that you'll use a 5-point scale, but doesn't state this, so you'll have to normalize this yourself.
Also, while "rating" this assumes - as per the "Based on now many reviews" input, that this is based on reviews and not ratings. If it is soley ratings, than "ratingCount" should be used rather than the provided "reviewCount".Product MIA: offers
Not an error, but kind of bizarre that this doesn't provide the ability to provide offer information (although event does).Testing
Given all of this I would certainly recommend that the order of the #4 and #5 be reversed (not just here, but anytime one is producing JSON-LD, as it can readily be tested as an independent code snippet, and in any case because the rest of the page code is irrelevant to validating a JSON-LD script block):
4. Paste JSON-LD in the <head> section of your HTML document.
5. Test implementation with the structured data testing tool.