Ad

JSON-LD: What Is The Correct Syntax For The Report Schema Type?

- 1 answer

I've used several JSON-LD formatting tools (Example 1, Example 2, Example 3), but none are so specific as to list the schema type Report, and its property reportNumber. The schema type is documented here, but without examples.

This page has been a helpful reference, but I still have uncertainty.

So I would like to know if the following syntax is correct, and what to change if it's not:

<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Report",
    "reportNumber": "1234",
    "headline": "Report Headline",
    "description": "Report Description",
    "image": "img.jpg", 
    "author": {
        "@type": "Organization",
        "name": "Org. Name",
        "url": "example.com"
    },  
    "publisher": {
        "@type": "Organization",
        "name": "Org. Name",
        "logo": {
            "@type": "ImageObject",
            "url": "logo.svg"
        }
    },
    "datePublished": "2021-11-24",
    "dateModified": "2021-11-24"
}
</script>

I just swapped the type Article for Report. It appears to me that Report is a subset of the Article type, making properties like headline and description still valid, but in addition, making the property reportNumber valid. I'm new to JSON-LD.

Ad

Answer

It looks like you are doing it correctly. In JSON-LD you can use any of the properties of a class in any of its subclasses.

In order to validate your JSON-LD, I have used the Google's structured tool JSON-LD validator, available at https://validator.schema.org/. I think you may find it useful in the future.

Your snippet passed the tests with zero errors or warnings. Just be careful with "logo.svg", because it is a relative path.I would add the full URL to your logo. The same applies for img.jpg

Ad
source: stackoverflow.com
Ad